﻿
#################################################
#												#
# 			ASSORTED BASIC EFFECTS 		 		#
#												#
#################################################

get_artifact_quality_effect = {
	if = {
		limit = {
			NOT = { exists = scope:quality }
		}
		# Some random variance is added so artifact quality isn't completely deterministic
		if = {
			limit = {
				NOR = {
					exists = scope:inspiration_owner
					exists = scope:random_quality_bonus
				}
			}
			random_list = {
				20 = {
					save_scope_value_as = {
						name = random_quality_bonus
						value = 4
					}
				}
				20 = {
					save_scope_value_as = {
						name = random_quality_bonus
						value = 8
					}
				}
				20 = {
					save_scope_value_as = {
						name = random_quality_bonus
						value = 12
					}
				}
				20 = {
					save_scope_value_as = {
						name = random_quality_bonus
						value = 16
					}
				}
				20 = {
					save_scope_value_as = {
						name = random_quality_bonus
						value = 20
					}
				}
			}
		}
		else_if = {
			limit = {
				NOT = { exists = scope:random_inspired_skill_quality_bonus }
			}
			random_list = {
				20 = {
					save_scope_value_as = {
						name = random_inspired_skill_quality_bonus
						value = 0.5
					}
				}
				20 = {
					save_scope_value_as = {
						name = random_inspired_skill_quality_bonus
						value = 1
					}
				}
				20 = {
					save_scope_value_as = {
						name = random_inspired_skill_quality_bonus
						value = 2
					}
				}
				20 = {
					save_scope_value_as = {
						name = random_inspired_skill_quality_bonus
						value = 2.5
					}
				}
				20 = {
					save_scope_value_as = {
						name = random_inspired_skill_quality_bonus
						value = 3
					}
				}
			}
			save_scope_value_as = {
				name = random_quality_bonus
				value = 0
			}
		}

		# Calculate the final quality of the artifact
		save_scope_value_as = {
			name = quality
			value = {
				value = scope:random_quality_bonus

				# Bonus Quality from the Court Owner's Amenities
				if = {
					limit = {
						exists = court_owner
						court_owner = {
							has_royal_court = yes
							has_dlc_feature = royal_court
							amenity_level = { type = court_lodging_standards value > low_amenity_level }
						}
					}
					if = {
						limit = { court_owner = { amenity_level = { type = court_lodging_standards value >= max_amenity_level } } }
						add = 10
					}
					else_if = {
						limit = { court_owner = { amenity_level = { type = court_lodging_standards value >= very_high_amenity_level } } }
						add = 8
					}
					else_if = {
						limit = { court_owner = { amenity_level = { type = court_lodging_standards value >= high_amenity_level } } }
						add = 6
					}
					else_if = {
						limit = { court_owner = { amenity_level = { type = court_lodging_standards value >= medium_amenity_level } } }
						add = 4
					}
					else = {
						add = 2
					}
				}

				# Bonus quality from Inspiration Owner
				if = {
					limit = { exists = scope:inspiration_owner }
					scope:inspiration_owner = {
						# Bonus quality from high skills, depending on inspiration type.
						add = {
							if = {
								limit = { ep1_character_had_or_has_inspiration_type_trigger = { TYPE = armor } }
								value = armor_inspiration_average_skill_value
							}
							else_if = {
								limit = { ep1_character_had_or_has_inspiration_type_trigger = { TYPE = weapon } }
								value = weapon_inspiration_average_skill_value
							}
							else_if = {
								limit = { ep1_character_had_or_has_inspiration_type_trigger = { TYPE = adventure } }
								value = adventure_inspiration_average_skill_value
							}
							else_if = {
								limit = { ep1_character_had_or_has_inspiration_type_trigger = { TYPE = smith } }
								value = smith_inspiration_average_skill_value
							}
							else_if = {
								limit = { ep1_character_had_or_has_inspiration_type_trigger = { TYPE = book } }
								value = book_inspiration_average_skill_value
							}
							else_if = {
								limit = { ep1_character_had_or_has_inspiration_type_trigger = { TYPE = weaver } }
								value = weaver_inspiration_average_skill_value
							}
							else_if = {
								limit = { ep1_character_had_or_has_inspiration_type_trigger = { TYPE = artisan } }
								value = artisan_inspiration_average_skill_value
							}
							else_if = {
								limit = { ep1_character_had_or_has_inspiration_type_trigger = { TYPE = alchemy } }
								value = alchemy_inspiration_average_skill_value
							} 
							multiply = {
								value = quality_bonus_per_skill_level_value
								add = scope:random_inspired_skill_quality_bonus # Replaces the random_quality_bonus when an artifact is created by a character so that skill matters more
							}
						}
						# Adventurer Bonuses
						if = {
							limit = {
								OR = {
									ep1_character_had_or_has_inspiration_type_trigger = { TYPE = weapon }
									ep1_character_had_or_has_inspiration_type_trigger = { TYPE = smith }
									ep1_character_had_or_has_inspiration_type_trigger = { TYPE = armor }
								}
								court_owner ?= {
									is_landless_adventurer = yes
									has_perk = divided_attention_perk
								}
							}
							add = 40
						}
						if = {
							limit = {
								ep1_character_had_or_has_inspiration_type_trigger = { TYPE = book }
								court_owner ?= {
									is_landless_adventurer = yes
									has_perk = divided_attention_perk
								}
							}
							add = 80
						}
						# Bonus quality from Cultural Traditions
						if = {
							limit = {
								ep1_character_had_or_has_inspiration_type_trigger = { TYPE = weapon }
								culture = { has_cultural_parameter = improved_weapon_inspiration }
							}
							add = 20
						}
						if = {
							limit = {
								ep1_character_had_or_has_inspiration_type_trigger = { TYPE = artisan }
								culture = { has_cultural_parameter = improved_artisan_inspiration }
							}
							add = 20
						}
						if = {
							limit = {
								ep1_character_had_or_has_inspiration_type_trigger = { TYPE = weaver }
								culture = { has_cultural_parameter = improved_weaver_inspiration }
							}
							add = 20
						}

						# Bonus quality from event outcomes involving the Inspiration Owner
						if = {
							limit = { exists = var:artifact_quality }
							add = {
								value = var:artifact_quality
								multiply = 3
							}
						}

						# Reduction on quality for 'local artisans', who should produce lower quality artifacts
						if = {
							limit = {
								has_character_flag = local_artisan
							}
							add = -10
						}
						# Other inspiration owners get a small bonus in quality to help distinguish them from 'local artisans'
						else = {
							add = 20
						}
					}

					# Bonuses from Buildings
					if = { #Smiths line
						limit = {
							exists = court_owner
							court_owner = {
								any_directly_owned_province = {
									has_building_or_higher = smiths_05
								}
							}
						}
						court_owner = {
							every_directly_owned_province = {
								limit = {
									has_building_or_higher = smiths_05
								}
								add = 2
							}
							every_directly_owned_province = {
								limit = {
									has_building_or_higher = smiths_06
								}
								add = 2
							}
							every_directly_owned_province = {
								limit = {
									has_building_or_higher = smiths_07
								}
								add = 2
							}
							every_directly_owned_province = {
								limit = {
									has_building_or_higher = smiths_08
								}
								add = 2
							}
						}
					}
					if = { #blacksmiths duchy building
						limit = {
							exists = court_owner
							court_owner = {
								any_directly_owned_province = {
									has_building_or_higher = blacksmiths_01
								}
							}
						}
						court_owner = {
							every_directly_owned_province = {
								limit = {
									has_building_or_higher = blacksmiths_01
								}
								add = 4
							}
							every_directly_owned_province = {
								limit = {
									has_building_or_higher = blacksmiths_02
								}
								add = 8
							}
							every_directly_owned_province = {
								limit = {
									has_building_or_higher = blacksmiths_03
								}
								add = 12
							}
						}
					}
					if = { #caravanserai line
						limit = {
							exists = court_owner
							court_owner = {
								any_directly_owned_province = {
									has_building_or_higher = caravanserai_04
								}
							}
						}
						court_owner = {
							every_directly_owned_province = {
								limit = {
									has_building_or_higher = caravanserai_04
								}
								add = 2
							}
							every_directly_owned_province = {
								limit = {
									has_building_or_higher = caravanserai_05
								}
								add = 2
							}
							every_directly_owned_province = {
								limit = {
									has_building_or_higher = caravanserai_06
								}
								add = 2
							}
							every_directly_owned_province = {
								limit = {
									has_building_or_higher = caravanserai_07
								}
								add = 2
							}
							every_directly_owned_province = {
								limit = {
									has_building_or_higher = caravanserai_08
								}
								add = 2
							}
						}
					}
					if = { #Wind Furnaces line
						limit = {
							exists = court_owner
							court_owner = {
								any_directly_owned_province = {
									has_building_or_higher = wind_furnace_04
								}
							}
							OR = {
								ep1_character_had_or_has_inspiration_type_trigger = { TYPE = armor }
								ep1_character_had_or_has_inspiration_type_trigger = { TYPE = weapon }
							}
						}
						court_owner = {
							every_directly_owned_province = {
								limit = {
									has_building_or_higher = wind_furnace_04
								}
								add = 6
							}
							every_directly_owned_province = {
								limit = {
									has_building_or_higher = wind_furnace_05
								}
								add = 4
							}
							every_directly_owned_province = {
								limit = {
									has_building_or_higher = wind_furnace_06
								}
								add = 4
							}
							every_directly_owned_province = {
								limit = {
									has_building_or_higher = wind_furnace_07
								}
								add = 4
							}
							every_directly_owned_province = {
								limit = {
									has_building_or_higher = wind_furnace_08
								}
								add = 4
							}
						}
					}
					if = { # Universities boost Book Inspirations
						limit = {
							exists = court_owner
							court_owner = {
								any_directly_owned_province = {
									has_university_building_trigger = yes
								}
							}
							ep1_character_had_or_has_inspiration_type_trigger = { TYPE = book }
						}
						add = 20
					}
					if = { # Special Mines boost things significantly
						limit = {
							exists = court_owner
							court_owner = {
								any_directly_owned_province = {
									has_any_special_mine_trigger = yes
								}
							}
							OR = {
								ep1_character_had_or_has_inspiration_type_trigger = { TYPE = armor }
								ep1_character_had_or_has_inspiration_type_trigger = { TYPE = weapon }
								ep1_character_had_or_has_inspiration_type_trigger = { TYPE = smith }
								ep1_character_had_or_has_inspiration_type_trigger = { TYPE = artisan }
							}
						}
						add = 20
					}
					
					# Bonus from Estates
					if = {
						limit = {
							exists = court_owner
							court_owner = {
								domicile ?= {
									has_domicile_parameter = estate_improved_inspirations_2
								}
							}
						}
						add = 10
					}
					else_if = {
						limit = {
							exists = court_owner
							court_owner = {
								domicile ?= {
									has_domicile_parameter = estate_improved_inspirations_1
								}
							}
						}
						add = 5
					}
				}

				#If it is worth bringing home from an adventure it is not common.
				if = {
					limit = {
						exists = scope:adventurer
					}
					add = 20
				}


				# Family Epic base quality
				if = {
					limit = {
						exists = scope:owner
						scope:owner = { has_variable = commission_epic_quality }
					}
					add = scope:owner.var:commission_epic_quality
				}
				# Old Ledger should not be too fancy (stewardship_wealth.1061)
				if = {
					limit = {
						exists = scope:low_quality
					}
					max = 20
				}

				# Exotic Arms event
				if = {
					limit = { exists = scope:exotic_blade_quality }
					if = {
						limit = { scope:exotic_blade_quality = no }
						max = 20
					}
					else = { max = 60 }
				}

				if = {
					limit = {
						exists = scope:owner
						scope:owner = { has_character_modifier = mpo_artifact_material_modifier }
					}
					add = 20
				}
				
				# Encouraging Words BP4 event
				if = {
					limit = { exists = scope:encouraging_words_quality_boost }
					add = 100
				}

				# Shogunate
				subtract = {
					value = 10
				}

				# Can't have negative quality
				min = 1
			}
		}
	}
}

get_artifact_wealth_effect = {
	if = {
		limit = {
			NOT = { exists = scope:wealth }
		}
		save_scope_value_as = {
			name = wealth
			value = {
				if = {
					# If our artifact already has a quality, set base wealth equal to 1/4th quality value.
					limit = { exists = scope:quality }
					add = scope:quality
					multiply = 0.25
					round = yes

				}
				else = {
					add = 10 # Otherwise, set base wealth value to 10.
				}

				if = {
					limit = {
						exists = scope:owner
						scope:owner.highest_held_title_tier >= 0
					}
					add = {
						# Add 10 wealth per character tier (up to a max of 50 wealth for emperors)
						value = scope:owner.highest_held_title_tier
						multiply = 10
					}

					# Add up to 25 wealth, scaling with capital's development
					if = {
						limit = {
							exists = scope:owner.capital_county
						}
						scope:owner.capital_county = {
							add = {
								value = development_level
								multiply = 0.25
							}
						}
					}

					# Tribal rulers get a final 50% penalty of all wealth modifiers for crafted artifacts.
					if = {
						limit = { scope:owner = { government_has_flag = government_is_tribal } }
						multiply = 0.50
					}
				}

				if = {
					limit = {
						exists = scope:inspiration_owner
					}
					scope:inspiration_owner = {
						# Bonuses from Buildings
						if = {
							limit = {
								exists = court_owner
								court_owner = {
									any_directly_owned_province = {
										has_building_or_higher = smiths_05
									}
								}
							}
							court_owner = {
								every_directly_owned_province = {
									limit = {
										has_building_or_higher = smiths_05
									}
									add = 2
								}
								every_directly_owned_province = {
									limit = {
										has_building_or_higher = smiths_06
									}
									add = 2
								}
								every_directly_owned_province = {
									limit = {
										has_building_or_higher = smiths_07
									}
									add = 2
								}
								every_directly_owned_province = {
									limit = {
										has_building_or_higher = smiths_08
									}
									add = 2
								}
								every_directly_owned_province = {
									limit = {
										has_building_or_higher = blacksmiths_01
									}
									add = 4
								}
								every_directly_owned_province = {
									limit = {
										has_building_or_higher = blacksmiths_02
									}
									add = 8
								}
								every_directly_owned_province = {
									limit = {
										has_building_or_higher = blacksmiths_03
									}
									add = 12
								}
							}
						}
						if = { # Special Mines boost things significantly
							limit = {
								exists = court_owner
								court_owner = {
									any_directly_owned_province = {
										has_any_special_mine_trigger = yes
									}
								}
								OR = {
									ep1_character_had_or_has_inspiration_type_trigger = { TYPE = armor }
									ep1_character_had_or_has_inspiration_type_trigger = { TYPE = weapon }
									ep1_character_had_or_has_inspiration_type_trigger = { TYPE = smith }
									ep1_character_had_or_has_inspiration_type_trigger = { TYPE = artisan }
								}
							}
							add = 20
						}
						if = { # Universities boost Book Inspirations
							limit = {
								exists = court_owner
								court_owner = {
									any_directly_owned_province = {
										has_university_building_trigger = yes
									}
								}
								ep1_character_had_or_has_inspiration_type_trigger = { TYPE = book }
							}
							add = 20
						}
					}
				}

				#If it is worth bringing home from an adventure it is not common.
				if = {
					limit = {
						exists = scope:adventurer
					}
					add = 20
				}

				# Lower wealth for 'local artisans', who should produce lower-quality artifacts.
				if = {
					limit = {
						exists = scope:inspiration_owner
						scope:inspiration_owner = {
							has_character_flag = local_artisan
						}
					}
					add = -20
				}
				# Old Ledger should not be too fancy (stewardship_wealth.1061)
				if = {
					limit = {
						exists = scope:low_quality
					}
					max = 20
				}

				# Exotic Arms event
				if = {
					limit = { exists = scope:exotic_blade_quality }
					if = {
						limit = { scope:exotic_blade_quality = no }
						max = 20
					}
					else = { max = 60 }
				}

				# Shogunate
				subtract = {
					value = 10
				}

				min = 1 #Can't have negative Wealth
			}
		}
	}
}

#Effect used to influence the artifact's quality
change_artifact_quality_effect = {
	save_scope_as = artifact_quality_scope
	inspiration = { save_scope_as = inspiration }
	if = {
		limit = {
			inspiration = { has_inspiration_type = research_inspiration }
		}
		if = {
			limit = {
				$AMOUNT$ > 3
			}
			custom_tooltip = fp3_scholarship_research_success_gain_effect
		}
		else_if = {
			limit = {
				$AMOUNT$ < -3
			}
			custom_tooltip = fp3_scholarship_research_success_loss_effect
		}
		else_if = {
			limit = {
				$AMOUNT$ > 0
			}
			custom_tooltip = fp3_scholarship_research_success_slight_gain_effect
		}
		else_if = {
			limit = {
				$AMOUNT$ < 0
			}
			custom_tooltip = fp3_scholarship_research_success_slight_loss_effect
		}
		scope:inspiration_owner = {
			change_variable = {
				name = research_success_chance
				add = $AMOUNT$
			}	
		}
	}
	else = {
		if = {
			limit = {
				$AMOUNT$ > 3
			}
			custom_tooltip = change_artifact_quality_effect_gain
		}
		else_if = {
			limit = {
				$AMOUNT$ > 0
			}
			custom_tooltip = change_artifact_quality_effect_slight_gain
		}
		else_if = {
			limit = {
				$AMOUNT$ > -3
			}
			custom_tooltip = change_artifact_quality_effect_slight_loss
		}
		else_if = {
			limit = {
				$AMOUNT$ <= -3
			}
			custom_tooltip = change_artifact_quality_effect_loss
		}
		hidden_effect = {
			if = {
				limit = {
					NOT = {
						exists = var:artifact_quality
					}
				}
				set_variable = {
					name = artifact_quality
					value = $AMOUNT$
				}
			}
			else = {
				change_variable = {
					name = artifact_quality
					add = $AMOUNT$
				}
			}
		}
	}
}

# Effect run to generate all required 'sub-features' for any existing features on an artifact.
get_artifact_feature_references_effect = {
	if = {
		limit = {
			artifact_needs_pattern_trigger = yes
		}
		set_artifact_feature_group = decoration_pattern
	}
	if = {
		limit = {
			artifact_needs_material_inlay_trigger = yes
		}
		set_artifact_feature_group = decoration_material_inlay
	}
	if = {
		limit = {
			artifact_needs_material_wire_trigger = yes
		}
		set_artifact_feature_group = decoration_material_wire
	}
	if = {
		limit = {
			artifact_needs_material_cloth_trigger = yes
		}
		set_artifact_feature_group = generic_material_cloth
	}
	if = {
		limit = {
			artifact_needs_material_gem_trigger = yes
		}
		set_artifact_feature_group = decoration_material_gem
	}
	if = {
		limit = {
			artifact_needs_material_hsb_trigger = yes
		}
		set_artifact_feature_group = decoration_material_inlay_HSB
	}
	if = {
		limit = {
			artifact_needs_material_wood_trigger = yes
		}
		set_artifact_feature_group = generic_material_wood
	}
	if = {
		limit = {
			has_artifact_feature = decoration_pattern_local_animal
		}
		scope:owner = {
			select_local_animal_effect = { TYPE = any } # Save scope to limit possible animals: any/big/small/dangerous/harmless/prowling
		}
	}
	if = {
		limit = {
			has_artifact_feature = icon_decoration_pattern_saint
		}
		set_artifact_feature_group = icon_decoration
		scope:owner = {
			select_random_saint_effect = yes
		}
	}
}


# A pared-down list of cloth with most purely decorative cloths removed. Used for cordage and structurally-important constructions.
get_cloth_type_sturdy_effect = {

	if = {
		limit = {
			NOT = { exists = scope:$SCOPE_NAME$ }
		}
		random_list = {
			# Wool
			# - Found literally everywhere
			30 = {  # Simple wool fabric, can vary wildly in quality and appearance depending on the yarn used to wave it as well as the weaver's skill.
				trigger = {	artifact_value_trigger = { VALUE = scope:wealth MIN = 0 MAX = 70 } }
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:wool }
			}
			10 = {  # Wool from the very first shearing of a sheep. Soft, elastic, and slippery, used in high-grade textiles.
				trigger = {	artifact_value_trigger = { VALUE = scope:wealth MIN = 70 MAX = 999 } }
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:lambswool }
			}

			# Silk
			#  - Found pretty much everywhere but subsaharan Africa.
			30 = { # Plain silk weave. Average quality, but carries some statue and value simply due to its material.
				trigger = {
					artifact_value_trigger = { VALUE = scope:wealth MIN = 30 MAX = 999 }
					NOT = { artifact_region_trigger = { CHARACTER = scope:owner REGION = material_cloth_no_silk } }
				}
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:silk }
			}

			# Linen
			# - Modern Germany was a major producer of linen, which was exported throughout all of Europe (but not really beyond that)
			40 = { # Plain weave flax fibers. Consistently average in quality and price, saw widespread use throughout the medieval era.
				trigger = {
					artifact_value_trigger = { VALUE = scope:wealth MIN = 0 MAX = 999 }
					artifact_region_trigger = { CHARACTER = scope:owner REGION = material_cloth_linen }
				}
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:linen }
			}
			30 = { # Twill cotton-linen blend. As it a mixed fabric, practicing Jews are forbidden to wear it.
				trigger = {
					artifact_value_trigger = { VALUE = scope:wealth MIN = 40 MAX = 999 }
					artifact_region_trigger = { CHARACTER = scope:owner REGION = material_cloth_cotton }
					NOT = { scope:owner.religion = religion:judaism_religion }
				}
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:fustian }
			}

			# Cotton
			# - Cotton has been grown in Egypt since ancient times, spread to Etheopia early on and then in the late medieval period to Europe and India.
			50 = { # Plain weave cotton
				trigger = {
					artifact_value_trigger = { VALUE = scope:wealth MIN = 0 MAX = 999 }
					artifact_region_trigger = { CHARACTER = scope:owner REGION = material_cloth_cotton }
				}
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:cotton }
			}
		}
	}
}

# A pared-down list of cloth containing only high-quality decorative threads. Used mostly for embroidery.
get_cloth_type_decorative_thread_effect = {
	if = {
		limit = {
			NOT = { exists = scope:$SCOPE_NAME$ }
		}
		random_list = {
			# Wool
			# - Found literally everywhere
			10 = {  # Wool from the very first shearing of a sheep. Soft, elastic, and slippery, used in high-grade textiles.
				trigger = {	artifact_value_trigger = { VALUE = scope:wealth MIN = 0 MAX = 999 } }
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:lambswool }
			}

			# Silk
			#  - Found pretty much everywhere but subsaharan Africa.
			30 = { # Plain silk weave. Average quality, but carries some statue and value simply due to its material.
				trigger = {
					artifact_value_trigger = { VALUE = scope:wealth MIN = 0 MAX = 70 }
					NOT = { artifact_region_trigger = { CHARACTER = scope:owner REGION = material_cloth_no_silk } }
				}
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:silk }
			}
			30 = { # Cloth woven from silk wrapped in silver. Similar to the cloth-of-gold below, but less expensive.
				trigger = {
					artifact_value_trigger = { VALUE = scope:wealth MIN = 40 MAX = 90 }
					NOT = { artifact_region_trigger = { CHARACTER = scope:owner REGION = material_cloth_no_silk } }
				}
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:cloth_of_silver }
			}
			50 = { # Cloth woven from silk wrapped in gold. In addition to being expensive, it was almost always outlawed for any non-royalty or non-clergy to wear.
				trigger = {
					artifact_value_trigger = { VALUE = scope:wealth MIN = 70 MAX = 999 }
					NOT = { artifact_region_trigger = { CHARACTER = scope:owner REGION = material_cloth_no_silk } }
				}
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:cloth_of_gold }
			}

			# Linen
			# - Modern Germany was a major producer of linen, which was exported throughout all of Europe (but not really beyond that)
			50 = { # Plain weave flax fibers. Consistently average in quality and price, saw widespread use throughout the medieval era.
				trigger = {
					artifact_value_trigger = { VALUE = scope:wealth MIN = 0 MAX = 60 }
					artifact_region_trigger = { CHARACTER = scope:owner REGION = material_cloth_linen }
				}
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:linen }
			}

			# Cotton
			# - Cotton has been grown in Egypt since ancient times, spread to Etheopia early on and then in the late medieval period to Europe and India.
			50 = { # Plain weave cotton
				trigger = {
					artifact_value_trigger = { VALUE = scope:wealth MIN = 0 MAX = 60 }
					artifact_region_trigger = { CHARACTER = scope:owner REGION = world_europe_west_britannia }
				}
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:cotton }
			}
		}
	}
}

# HSB = Horn, Shell, Bone. Picks a semi-random material suitable for carving, inlay or other decorations.
# Basically animal-based materials that have a wide array of applications.
get_hsb_type_effect = {
	if = {
		limit = {
			NOT = { exists = scope:$SCOPE_NAME$ }
		}
		random_list = {
			# Common. All regions should have access to at least one of these.
			20 = { # Camel Bone
				trigger = {
					artifact_region_trigger = { CHARACTER = scope:owner REGION = material_hsb_camel_bone }
				}
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:hsb_camel_bone }
			}
			20 = { # Deer Antler
				trigger = {
					artifact_region_trigger = { CHARACTER = scope:owner REGION = material_hsb_deer_antler }
				}
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:hsb_deer_antler }
			}
			20 = { # Boar Tusk
				trigger = {
					artifact_region_trigger = { CHARACTER = scope:owner REGION = material_hsb_boar_tusk }
				}
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:hsb_boar_tusk }
			}
			20 = { # Seashell
				trigger = {
					artifact_region_trigger = { CHARACTER = scope:owner REGION = material_hsb_seashell }
				}
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:hsb_seashell }
			}

			# Rare, Expensive, or Region-Specifc. Not all regions will have access to these.
			80 = { # Tortoiseshell
				trigger = {
					AND = {
						artifact_value_trigger = { VALUE = scope:wealth MIN = 50 MAX = 999 }
						artifact_region_trigger = { CHARACTER = scope:owner REGION = material_hsb_tortoiseshell }
					}
				}
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:hsb_tortoiseshell }
			}
			80 = { # Mother of Pearl
				trigger = {
					AND = {
						artifact_value_trigger = { VALUE = scope:wealth MIN = 50 MAX = 999 }
						artifact_region_trigger = { CHARACTER = scope:owner REGION = material_hsb_mother_of_pearl }
					}
				}
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:hsb_mother_of_pearl }
			}
			80 = { # Ivory (Native)
				trigger = {
					AND = {
						artifact_value_trigger = { VALUE = scope:wealth MIN = 50 MAX = 999 }
						artifact_region_trigger = { CHARACTER = scope:owner REGION = material_hsb_ivory_native }
					}
				}
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:hsb_ivory }
			}
			40 = { # Ivory (Imported)
				trigger = {
					AND = {
						artifact_value_trigger = { VALUE = scope:wealth MIN = 80 MAX = 999 }
						artifact_region_trigger = { CHARACTER = scope:owner REGION = material_hsb_ivory_imported }
					}
				}
				save_scope_value_as = { name = $SCOPE_NAME$	value = flag:hsb_ivory }
			}
		}
	}
}

add_scaled_artifact_modifier_prowess_effect = {
	if = {
		limit = {
			rarity = common
		}
		random_list = {
			20 = {
				# Base is 1 prowess
			}
			15 = {
				add_artifact_modifier = artifact_prowess_1_modifier
				if = { # Daggers get less Prowess
					limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger }
					add_artifact_modifier = artifact_prowess_1_negative_modifier
				}
			}
			5 = {
				add_artifact_modifier = artifact_prowess_2_modifier
				if = { # Daggers get less Prowess
					limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger }
					add_artifact_modifier = artifact_prowess_1_negative_modifier
				}
			}
		}
	}
	else_if = {
		limit = {
			rarity = masterwork
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_prowess_3_modifier
				if = { # Daggers get less Prowess
					limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger }
					add_artifact_modifier = artifact_prowess_1_negative_modifier
				}
			}
			15 = {
				add_artifact_modifier = artifact_prowess_4_modifier
				if = { # Daggers get less Prowess
					limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger }
					add_artifact_modifier = artifact_prowess_1_negative_modifier
				}
			}
			5 = {
				add_artifact_modifier = artifact_prowess_5_modifier
				if = { # Daggers get less Prowess
					limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger }
					add_artifact_modifier = artifact_prowess_1_negative_modifier
				}
			}
		}
	}
	else_if = {
		limit = {
			rarity = famed
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_prowess_6_modifier
				if = { # Daggers get less Prowess
					limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger }
					add_artifact_modifier = artifact_prowess_2_negative_modifier
				}
			}
			15 = {
				add_artifact_modifier = artifact_prowess_7_modifier
				if = { # Daggers get less Prowess
					limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger }
					add_artifact_modifier = artifact_prowess_2_negative_modifier
				}
			}
			5 = {
				add_artifact_modifier = artifact_prowess_8_modifier
				if = { # Daggers get less Prowess
					limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger }
					add_artifact_modifier = artifact_prowess_2_negative_modifier
				}
			}
		}
	}
	else_if = {
		limit = {
			rarity = illustrious
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_prowess_9_modifier
				if = { # Daggers get less Prowess
					limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger }
					add_artifact_modifier = artifact_prowess_2_negative_modifier
				}
			}
			15 = {
				add_artifact_modifier = artifact_prowess_10_modifier
				if = { # Daggers get less Prowess
					limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger }
					add_artifact_modifier = artifact_prowess_2_negative_modifier
				}
			}
			5 = {
				add_artifact_modifier = artifact_prowess_11_modifier
				if = { # Daggers get less Prowess
					limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger }
					add_artifact_modifier = artifact_prowess_2_negative_modifier
				}
			}
		}
	}
}

add_scaled_artifact_modifier_combat_effect = {
	random_list = {
		# Knight Limit
		20 = {
			trigger = {
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_knights_mod }
				add = 160
			}
			if = {
				limit = {
					rarity = famed
				}
				add_artifact_modifier = artifact_knight_limit_1_modifier
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				add_artifact_modifier = artifact_knight_limit_2_modifier
			}
		}

		# Knight Effectiveness
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_knights_mod }
				add = 160
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_knight_effectiveness_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_knight_effectiveness_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_knight_effectiveness_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_knight_effectiveness_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_knight_effectiveness_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_knight_effectiveness_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_knight_effectiveness_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_knight_effectiveness_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_knight_effectiveness_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_knight_effectiveness_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_knight_effectiveness_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_knight_effectiveness_12_modifier
					}
				}
			}

			modifier = { # More likely if you have any "knightly" cultural traditions
				factor = 1.5
				scope:owner = {
					OR = {
						culture = { has_cultural_tradition = tradition_chivalry }
						culture = { has_cultural_tradition = tradition_martial_admiration }
						culture = { has_cultural_tradition = tradition_futuwaa }
						culture = { has_cultural_tradition = tradition_druzhina }
						culture = { has_cultural_tradition = tradition_chanson_de_geste }
					}
				}
			}
		}

		# negate_prowess_penalty_add
		20 = {
			trigger = {
				artifact_slot_type = armor
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_negate_prowess_penalty_add_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_negate_prowess_penalty_add_2_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_negate_prowess_penalty_add_3_modifier
					}
					15 = {
						add_artifact_modifier = artifact_negate_prowess_penalty_add_4_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_negate_prowess_penalty_add_5_modifier
					}
					15 = {
						add_artifact_modifier = artifact_negate_prowess_penalty_add_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_negate_prowess_penalty_add_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_negate_prowess_penalty_add_8_modifier
					}
				}
			}
		}

		# Controlled Province Advantage
		20 = {
			trigger = {
				artifact_slot_type = armor
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_controlled_province_advantage_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_controlled_province_advantage_2_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_controlled_province_advantage_3_modifier
					}
					15 = {
						add_artifact_modifier = artifact_controlled_province_advantage_4_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_controlled_province_advantage_5_modifier
					}
					15 = {
						add_artifact_modifier = artifact_controlled_province_advantage_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_controlled_province_advantage_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_controlled_province_advantage_8_modifier
					}
				}
			}
		}

		# Tolerance Advantage — exclusive to weapons with religious decorations
		40 = {
			trigger = { artifact_has_religious_decorations_trigger = yes }
			if = {
				limit = {
					rarity = common
				}
				add_artifact_modifier = artifact_tolerance_advantage_mod_1_modifier
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				add_artifact_modifier = artifact_tolerance_advantage_mod_2_modifier
			}
			else_if = {
				limit = {
					rarity = famed
				}
				add_artifact_modifier = artifact_tolerance_advantage_mod_3_modifier
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				add_artifact_modifier = artifact_tolerance_advantage_mod_4_modifier
			}
		}

		# Levy Reinforcement Rate Same Faith — exclusive to weapons with religious decorations
		40 = {
			trigger = { artifact_has_religious_decorations_trigger = yes }
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_12_modifier
					}
				}
			}
		}

		# zealot_levy_contribution_mult — exclusive to weapons with religious decorations
		40 = {
			trigger = { artifact_has_religious_decorations_trigger = yes }
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_zealot_levy_contribution_mult_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_zealot_levy_contribution_mult_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_zealot_levy_contribution_mult_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_zealot_levy_contribution_mult_4_modifier
			}
		}

		# glory_hound_levy_contribution_mult
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_glory_hound_levy_contribution_mult_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_glory_hound_levy_contribution_mult_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_glory_hound_levy_contribution_mult_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_glory_hound_levy_contribution_mult_4_modifier
			}
		}

		# belligerent_levy_contribution_mult
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_belligerent_levy_contribution_mult_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_belligerent_levy_contribution_mult_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_belligerent_levy_contribution_mult_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_belligerent_levy_contribution_mult_4_modifier
			}
		}

		# Raid Speed - exclusive to cultures that can raid
		40 = {
			trigger = {
				artifact_slot_type = primary_armament
				scope:owner = {
					can_raid_trigger = yes
				}
			}
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_raid_mod }
				add = 120
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_raid_speed_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_raid_speed_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_raid_speed_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_raid_speed_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_raid_speed_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_raid_speed_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_raid_speed_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_raid_speed_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_raid_speed_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_raid_speed_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_raid_speed_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_raid_speed_12_modifier
					}
				}
			}
		}

		# enemy_hard_casualty_modifier
		20 = {
			trigger = {
				artifact_slot_type = primary_armament
			}
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_casualties_mod }
				add = 160
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_12_modifier
					}
				}
			}
		}

		# hard_casualty_modifier
		20 = {
			trigger = {
				artifact_slot_type = armor
			}
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_casualties_mod }
				add = 160
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_12_modifier
					}
				}
			}
		}

		# terrain_advantage
		20 = {
			trigger = {
				artifact_slot_type = primary_armament
				scope:owner = {
					OR = {
						any_sub_realm_county = {
							count >= 5
							title_province = {
								OR = {
									terrain = plains
									terrain = farmlands
									terrain = hills
									terrain = mountains
									terrain = desert
									terrain = desert_mountains
									terrain = oasis
									terrain = jungle
									terrain = forest
									terrain = taiga
									terrain = wetlands
									terrain = steppe
									terrain = floodplains
									terrain = drylands
								}
							}
						}
						any_sub_realm_county = {
							percent >= 0.3
							title_province = {
								OR = {
									terrain = plains
									terrain = farmlands
									terrain = hills
									terrain = mountains
									terrain = desert
									terrain = desert_mountains
									terrain = oasis
									terrain = jungle
									terrain = forest
									terrain = taiga
									terrain = wetlands
									terrain = steppe
									terrain = floodplains
									terrain = drylands
								}
							}
						}
					}
				}
			}
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_terrain_mod }
				add = 160
			}
			random_list = {
				10 = { # plains_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = plains
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = plains
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_plains_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_plains_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_plains_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_plains_advantage_4_modifier
					}
				}
				10 = { # farmlands_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = farmlands
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = farmlands
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_farmlands_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_farmlands_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_farmlands_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_farmlands_advantage_4_modifier
					}
				}
				10 = { # hills_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = hills
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = hills
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_hills_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_hills_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_hills_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_hills_advantage_4_modifier
					}
				}
				10 = { # mountains_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = mountains
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = mountains
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_mountains_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_mountains_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_mountains_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_mountains_advantage_4_modifier
					}
				}
				10 = { # desert_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = desert
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = desert
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_desert_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_desert_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_desert_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_desert_advantage_4_modifier
					}
				}
				10 = { # desert_mountains_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = desert_mountains
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = desert_mountains
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_desert_mountains_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_desert_mountains_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_desert_mountains_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_desert_mountains_advantage_4_modifier
					}
				}
				10 = { # oasis_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = oasis
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = oasis
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_oasis_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_oasis_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_oasis_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_oasis_advantage_4_modifier
					}
				}
				10 = { # jungle_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = jungle
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = jungle
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_jungle_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_jungle_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_jungle_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_jungle_advantage_4_modifier
					}
				}
				10 = { # forest_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = forest
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = forest
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_forest_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_forest_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_forest_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_forest_advantage_4_modifier
					}
				}
				10 = { # taiga_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = taiga
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = taiga
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_taiga_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_taiga_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_taiga_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_taiga_advantage_4_modifier
					}
				}
				10 = { # wetlands_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = wetlands
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = wetlands
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_wetlands_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_wetlands_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_wetlands_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_wetlands_advantage_4_modifier
					}
				}
				10 = { # steppe_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = steppe
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = steppe
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_steppe_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_steppe_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_steppe_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_steppe_advantage_4_modifier
					}
				}
				10 = { # floodplains_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = floodplains
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = floodplains
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_floodplains_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_floodplains_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_floodplains_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_floodplains_advantage_4_modifier
					}
				}
				10 = { # drylands_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = drylands
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = drylands
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_drylands_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_drylands_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_drylands_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_drylands_advantage_4_modifier
					}
				}
			}
		}

		# pursue_efficiency
		20 = {
			trigger = {
				artifact_slot_type = primary_armament
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_pursue_efficiency_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_pursue_efficiency_2_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_pursue_efficiency_3_modifier
					}
					15 = {
						add_artifact_modifier = artifact_pursue_efficiency_4_modifier
					}
				}
			}
		}

		# retreat_losses
		20 = {
			trigger = {
				artifact_slot_type = armor
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_retreat_losses_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_retreat_losses_2_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_retreat_losses_3_modifier
					}
					15 = {
						add_artifact_modifier = artifact_retreat_losses_4_modifier
					}
				}
			}
		}
	}
}

add_2_scaled_artifact_modifier_combat_effect = {
	random_list = {
		pick = 2
		unique = yes
		# Knight Limit
		20 = {
			trigger = {
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_knights_mod }
				add = 160
			}
			if = {
				limit = {
					rarity = famed
				}
				add_artifact_modifier = artifact_knight_limit_1_modifier
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				add_artifact_modifier = artifact_knight_limit_2_modifier
			}
		}

		# Knight Effectiveness
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_knights_mod }
				add = 160
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_knight_effectiveness_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_knight_effectiveness_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_knight_effectiveness_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_knight_effectiveness_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_knight_effectiveness_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_knight_effectiveness_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_knight_effectiveness_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_knight_effectiveness_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_knight_effectiveness_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_knight_effectiveness_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_knight_effectiveness_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_knight_effectiveness_12_modifier
					}
				}
			}

			modifier = { # More likely if you have any "knightly" cultural traditions
				factor = 1.5
				scope:owner = {
					OR = {
						culture = { has_cultural_tradition = tradition_chivalry }
						culture = { has_cultural_tradition = tradition_martial_admiration }
						culture = { has_cultural_tradition = tradition_futuwaa }
						culture = { has_cultural_tradition = tradition_druzhina }
						culture = { has_cultural_tradition = tradition_chanson_de_geste }
					}
				}
			}
		}

		# negate_prowess_penalty_add
		20 = {
			trigger = {
				artifact_slot_type = armor
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_negate_prowess_penalty_add_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_negate_prowess_penalty_add_2_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_negate_prowess_penalty_add_3_modifier
					}
					15 = {
						add_artifact_modifier = artifact_negate_prowess_penalty_add_4_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_negate_prowess_penalty_add_5_modifier
					}
					15 = {
						add_artifact_modifier = artifact_negate_prowess_penalty_add_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_negate_prowess_penalty_add_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_negate_prowess_penalty_add_8_modifier
					}
				}
			}
		}

		# Controlled Province Advantage
		20 = {
			trigger = {
				artifact_slot_type = armor
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_controlled_province_advantage_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_controlled_province_advantage_2_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_controlled_province_advantage_3_modifier
					}
					15 = {
						add_artifact_modifier = artifact_controlled_province_advantage_4_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_controlled_province_advantage_5_modifier
					}
					15 = {
						add_artifact_modifier = artifact_controlled_province_advantage_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_controlled_province_advantage_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_controlled_province_advantage_8_modifier
					}
				}
			}
		}

		# Tolerance Advantage — exclusive to weapons with religious decorations
		40 = {
			trigger = { artifact_has_religious_decorations_trigger = yes }
			if = {
				limit = {
					rarity = common
				}
				add_artifact_modifier = artifact_tolerance_advantage_mod_1_modifier
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				add_artifact_modifier = artifact_tolerance_advantage_mod_2_modifier
			}
			else_if = {
				limit = {
					rarity = famed
				}
				add_artifact_modifier = artifact_tolerance_advantage_mod_3_modifier
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				add_artifact_modifier = artifact_tolerance_advantage_mod_4_modifier
			}
		}

		# Levy Reinforcement Rate Same Faith — exclusive to weapons with religious decorations
		40 = {
			trigger = { artifact_has_religious_decorations_trigger = yes }
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_12_modifier
					}
				}
			}
		}

		# Raid Speed - exclusive to cultures that can raid
		40 = {
			trigger = {
				artifact_slot_type = primary_armament
				scope:owner = {
					can_raid_trigger = yes
				}
			}
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_raid_mod }
				add = 120
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_raid_speed_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_raid_speed_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_raid_speed_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_raid_speed_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_raid_speed_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_raid_speed_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_raid_speed_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_raid_speed_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_raid_speed_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_raid_speed_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_raid_speed_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_raid_speed_12_modifier
					}
				}
			}
		}

		# enemy_hard_casualty_modifier
		20 = {
			trigger = {
				artifact_slot_type = primary_armament
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_enemy_hard_casualty_modifier_12_modifier
					}
				}
			}
		}

		# hard_casualty_modifier
		20 = {
			trigger = {
				artifact_slot_type = armor
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_hard_casualty_modifier_12_modifier
					}
				}
			}
		}

		# terrain_advantage
		20 = {
			trigger = {
				artifact_slot_type = primary_armament
				scope:owner = {
					OR = {
						any_sub_realm_county = {
							count >= 5
							title_province = {
								OR = {
									terrain = plains
									terrain = farmlands
									terrain = hills
									terrain = mountains
									terrain = desert
									terrain = desert_mountains
									terrain = oasis
									terrain = jungle
									terrain = forest
									terrain = taiga
									terrain = wetlands
									terrain = steppe
									terrain = floodplains
									terrain = drylands
								}
							}
						}
						any_sub_realm_county = {
							percent >= 0.3
							title_province = {
								OR = {
									terrain = plains
									terrain = farmlands
									terrain = hills
									terrain = mountains
									terrain = desert
									terrain = desert_mountains
									terrain = oasis
									terrain = jungle
									terrain = forest
									terrain = taiga
									terrain = wetlands
									terrain = steppe
									terrain = floodplains
									terrain = drylands
								}
							}
						}
					}
				}
			}
			random_list = {
				10 = { # plains_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = plains
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = plains
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_plains_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_plains_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_plains_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_plains_advantage_4_modifier
					}
				}
				10 = { # farmlands_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = farmlands
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = farmlands
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_farmlands_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_farmlands_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_farmlands_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_farmlands_advantage_4_modifier
					}
				}
				10 = { # hills_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = hills
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = hills
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_hills_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_hills_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_hills_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_hills_advantage_4_modifier
					}
				}
				10 = { # mountains_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = mountains
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = mountains
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_mountains_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_mountains_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_mountains_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_mountains_advantage_4_modifier
					}
				}
				10 = { # desert_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = desert
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = desert
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_desert_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_desert_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_desert_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_desert_advantage_4_modifier
					}
				}
				10 = { # desert_mountains_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = desert_mountains
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = desert_mountains
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_desert_mountains_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_desert_mountains_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_desert_mountains_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_desert_mountains_advantage_4_modifier
					}
				}
				10 = { # oasis_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = oasis
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = oasis
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_oasis_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_oasis_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_oasis_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_oasis_advantage_4_modifier
					}
				}
				10 = { # jungle_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = jungle
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = jungle
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_jungle_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_jungle_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_jungle_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_jungle_advantage_4_modifier
					}
				}
				10 = { # forest_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = forest
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = forest
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_forest_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_forest_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_forest_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_forest_advantage_4_modifier
					}
				}
				10 = { # taiga_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = taiga
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = taiga
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_taiga_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_taiga_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_taiga_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_taiga_advantage_4_modifier
					}
				}
				10 = { # wetlands_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = wetlands
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = wetlands
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_wetlands_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_wetlands_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_wetlands_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_wetlands_advantage_4_modifier
					}
				}
				10 = { # steppe_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = steppe
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = steppe
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_steppe_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_steppe_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_steppe_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_steppe_advantage_4_modifier
					}
				}
				10 = { # floodplains_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = floodplains
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = floodplains
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_floodplains_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_floodplains_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_floodplains_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_floodplains_advantage_4_modifier
					}
				}
				10 = { # drylands_advantage
					trigger = {
						scope:owner = {
							OR = {
								any_sub_realm_county = {
									count >= 5
									title_province = {
										terrain = drylands
									}
								}
								any_sub_realm_county = {
									percent >= 0.3
									title_province = {
										terrain = drylands
									}
								}
							}
						}
					}
					if = {
						limit = {
							rarity = common
						}
						add_artifact_modifier = artifact_drylands_advantage_1_modifier
					}
					else_if = {
						limit = {
							rarity = masterwork
						}
						add_artifact_modifier = artifact_drylands_advantage_2_modifier
					}
					else_if = {
						limit = {
							rarity = famed
						}
						add_artifact_modifier = artifact_drylands_advantage_3_modifier
					}
					else_if = {
						limit = {
							rarity = illustrious
						}
						add_artifact_modifier = artifact_drylands_advantage_4_modifier
					}
				}
			}
		}

		# pursue_efficiency
		20 = {
			trigger = {
				artifact_slot_type = primary_armament
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_pursue_efficiency_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_pursue_efficiency_2_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_pursue_efficiency_3_modifier
					}
					15 = {
						add_artifact_modifier = artifact_pursue_efficiency_4_modifier
					}
				}
			}
		}

		# retreat_losses
		20 = {
			trigger = {
				artifact_slot_type = armor
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_retreat_losses_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_retreat_losses_2_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_retreat_losses_3_modifier
					}
					15 = {
						add_artifact_modifier = artifact_retreat_losses_4_modifier
					}
				}
			}
		}
	}
}

add_scaled_artifact_modifier_prestige_effect = {
	if = {
		limit = {
			rarity = common
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_monthly_prestige_1_modifier
			}
			15 = {
				add_artifact_modifier = artifact_monthly_prestige_2_modifier
			}
		}
	}
	else_if = {
		limit = {
			rarity = masterwork
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_monthly_prestige_3_modifier
			}
			15 = {
				add_artifact_modifier = artifact_monthly_prestige_4_modifier
			}
		}
	}
	else_if = {
		limit = {
			rarity = famed
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_monthly_prestige_5_modifier
			}
			15 = {
				add_artifact_modifier = artifact_monthly_prestige_6_modifier
			}
		}
	}
	else_if = {
		limit = {
			rarity = illustrious
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_monthly_prestige_7_modifier
			}
			15 = {
				add_artifact_modifier = artifact_monthly_prestige_8_modifier
			}
		}
	}
}

add_scaled_artifact_modifier_minor_prestige_effect = {
	if = {
		limit = {
			rarity = common
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_monthly_minor_prestige_1_modifier
			}
			15 = {
				add_artifact_modifier = artifact_monthly_minor_prestige_2_modifier
			}
		}
	}
	else_if = {
		limit = {
			rarity = masterwork
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_monthly_minor_prestige_3_modifier
			}
			15 = {
				add_artifact_modifier = artifact_monthly_minor_prestige_4_modifier
			}
		}
	}
	else_if = {
		limit = {
			rarity = famed
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_monthly_minor_prestige_5_modifier
			}
			15 = {
				add_artifact_modifier = artifact_monthly_minor_prestige_6_modifier
			}
		}
	}
	else_if = {
		limit = {
			rarity = illustrious
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_monthly_minor_prestige_7_modifier
			}
			15 = {
				add_artifact_modifier = artifact_monthly_minor_prestige_8_modifier
			}
		}
	}
}

add_scaled_artifact_modifier_grandeur_big_effect = {
	if = {
		limit = { rarity = illustrious }
		random_list = {
			20 = {
				add_artifact_modifier = artifact_court_grandeur_baseline_add_5_modifier
			}
			10 = {
				add_artifact_modifier = artifact_court_grandeur_baseline_add_6_modifier
			}
		}
	}
	else_if = {
		limit = { rarity = famed }
		random_list = {
			20 = {
				add_artifact_modifier = artifact_court_grandeur_baseline_add_3_modifier
			}
			10 = {
				add_artifact_modifier = artifact_court_grandeur_baseline_add_4_modifier
			}
		}
	}
	else_if = {
		limit = { rarity = masterwork }
		random_list = {
			20 = {
				add_artifact_modifier = artifact_court_grandeur_baseline_add_2_modifier
			}
			10 = {
				add_artifact_modifier = artifact_court_grandeur_baseline_add_3_modifier
			}
		}
	}
	else = {
		random_list = {
			20 = {
				add_artifact_modifier = artifact_court_grandeur_baseline_add_1_modifier
			}
			10 = {
				add_artifact_modifier = artifact_court_grandeur_baseline_add_2_modifier
			}
		}
	}
}

add_scaled_artifact_modifier_grandeur_small_effect = {
	if = {
		limit = { rarity = illustrious }
		add_artifact_modifier = artifact_court_grandeur_baseline_add_4_modifier
	}
	else_if = {
		limit = { rarity = famed }
		add_artifact_modifier = artifact_court_grandeur_baseline_add_3_modifier
	}
	else_if = {
		limit = { rarity = masterwork }
		add_artifact_modifier = artifact_court_grandeur_baseline_add_2_modifier
	}
	else = {
		random_list = {
			10 = {
				add_artifact_modifier = artifact_court_grandeur_baseline_add_1_modifier
			}
			10 = {}
		}
	}
}

add_scaled_artifact_modifier_piety_effect = {
	if = {
		limit = {
			rarity = common
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_monthly_piety_1_modifier
			}
			15 = {
				add_artifact_modifier = artifact_monthly_piety_2_modifier
			}
		}
	}
	else_if = {
		limit = {
			rarity = masterwork
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_monthly_piety_3_modifier
			}
			15 = {
				add_artifact_modifier = artifact_monthly_piety_4_modifier
			}
		}
	}
	else_if = {
		limit = {
			rarity = famed
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_monthly_piety_5_modifier
			}
			15 = {
				add_artifact_modifier = artifact_monthly_piety_6_modifier
			}
		}
	}
	else_if = {
		limit = {
			rarity = illustrious
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_monthly_piety_7_modifier
			}
			15 = {
				add_artifact_modifier = artifact_monthly_piety_8_modifier
			}
		}
	}
}

add_scaled_artifact_modifier_dynasty_prestige_effect = {
	if = {
		limit = {
			rarity = common
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_monthly_prestige_add_1_modifier
			}
			15 = {
				add_artifact_modifier = artifact_monthly_prestige_add_2_modifier
			}
		}
	}
	else_if = {
		limit = {
			rarity = masterwork
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_monthly_prestige_add_3_modifier
			}
			15 = {
				add_artifact_modifier = artifact_monthly_prestige_add_4_modifier
			}
		}
	}
	else_if = {
		limit = {
			rarity = famed
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_monthly_prestige_add_5_modifier
			}
			15 = {
				add_artifact_modifier = artifact_monthly_prestige_add_6_modifier
			}
		}
	}
	else_if = {
		limit = {
			rarity = illustrious
		}
		random_list = {
			20 = {
				add_artifact_modifier = artifact_monthly_prestige_add_7_modifier
			}
			15 = {
				add_artifact_modifier = artifact_monthly_prestige_add_8_modifier
			}
		}
	}
}

add_scaled_artifact_modifier_majesty_effect = {
	random_list = {
		#pick = 2
		#unique = yes

		# Short Reign Duration
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_reign_mod }
				add = 160
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_short_reign_duration_mult_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_short_reign_duration_mult_2_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_short_reign_duration_mult_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_short_reign_duration_mult_4_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_short_reign_duration_mult_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_short_reign_duration_mult_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_short_reign_duration_mult_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_short_reign_duration_mult_8_modifier
					}
				}
			}
		}

		# Dynasty Opinion
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_dynasty_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_dynasty_opinion_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_dynasty_opinion_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_dynasty_opinion_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_dynasty_opinion_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_dynasty_opinion_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_dynasty_opinion_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_dynasty_opinion_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_dynasty_opinion_8_modifier
					}
				}
			}
		}

		# Dynasty Prestige
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_dynasty_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_prestige_add_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_prestige_add_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_prestige_add_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_prestige_add_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_prestige_add_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_prestige_add_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_prestige_add_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_prestige_add_8_modifier
					}
				}
			}
		}

		# Dynasty Prestige Mult
		20 = {
			trigger = {
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_dynasty_prestige_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_dynasty_prestige_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_dynasty_prestige_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_dynasty_prestige_4_modifier
					}
				}
			}
		}

		# Extra Prestige Gain
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_dread_mod }
				add = 160
			}
			random_list = {
				50 = { # Prestige per Dread
					modifier = {
						exists = scope:inspiration_owner
						scope:inspiration_owner = { dread < 1 }
						factor = 0
					}
					modifier = {
						exists = scope:inspiration_owner
						scope:inspiration_owner = { has_variable = chosen_dread_mod }
						add = 160
					}
					if = {
						limit = { rarity = common }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_1_modifier
					}
					else_if = {
						limit = { rarity = masterwork }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_2_modifier
					}
					else_if = {
						limit = { rarity = famed }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_3_modifier
					}
					else_if = {
						limit = { rarity = illustrious }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_4_modifier
					}
				}
				50 = { # Prestige per Knight
					if = {
						limit = { rarity = common }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_knight_add_1_modifier
					}
					else_if = {
						limit = { rarity = masterwork }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_knight_add_2_modifier
					}
					else_if = {
						limit = { rarity = famed }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_knight_add_3_modifier
					}
					else_if = {
						limit = { rarity = illustrious }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_knight_add_4_modifier
					}
				}
				50 = { # Prestige per Powerful Vassal
					if = {
						limit = { rarity = common }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_1_modifier
					}
					else_if = {
						limit = { rarity = masterwork }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_2_modifier
					}
					else_if = {
						limit = { rarity = famed }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_3_modifier
					}
					else_if = {
						limit = { rarity = illustrious }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_4_modifier
					}
				}
			}
		}

		# Tyranny Decay
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_dread_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_tyranny_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_tyranny_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_tyranny_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_tyranny_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_tyranny_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_tyranny_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_tyranny_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_tyranny_8_modifier
					}
				}
			}
		}

		# happy_powerful_vassal_tax_contribution_mult
		20 = {
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_8_modifier
					}
				}
			}
		}

		# courtly_tax_contribution_mult
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_courtly_tax_contribution_mult_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_courtly_tax_contribution_mult_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_courtly_tax_contribution_mult_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_courtly_tax_contribution_mult_4_modifier
			}
		}

		# glory_hound_tax_contribution_mult
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_glory_hound_tax_contribution_mult_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_glory_hound_tax_contribution_mult_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_glory_hound_tax_contribution_mult_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_glory_hound_tax_contribution_mult_4_modifier
			}
		}

		# mercenary_hire_cost_mult
		20 = {
			trigger = {
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_mercenary_hire_cost_mult_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_mercenary_hire_cost_mult_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_mercenary_hire_cost_mult_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_mercenary_hire_cost_mult_4_modifier
					}
				}
			}
		}

		# courtly_opinion
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_courtly_vassal_opinion_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_courtly_vassal_opinion_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_courtly_vassal_opinion_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_courtly_vassal_opinion_4_modifier
			}
		}

		# glory_hound_opinion
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_glory_hound_vassal_opinion_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_glory_hound_vassal_opinion_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_glory_hound_vassal_opinion_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_glory_hound_vassal_opinion_4_modifier
			}
		}

		# vassal_tax_contribution_mult
		20 = {
			trigger = {
				rarity = illustrious
			}
			random_list = {
				20 = {
					add_artifact_modifier = artifact_vassal_tax_contribution_mult_2_modifier
				}
				10 = {
					add_artifact_modifier = artifact_vassal_tax_contribution_mult_4_modifier
				}
			}
		}

		# general_opinion
		20 = {
			trigger = {
				rarity = illustrious
			}
			add_artifact_modifier = artifact_general_opinion_1_modifier
		}

		# Diplomacy per Prestige Level
		20 = {
			trigger = {
				artifact_slot_type = throne
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			add_artifact_modifier = artifact_diplomacy_per_prestige_level_modifier
		}
	}
}

add_2_scaled_artifact_modifier_majesty_effect = {
	random_list = {
		pick = 2
		unique = yes

		# Short Reign Duration
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_reign_mod }
				add = 160
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_short_reign_duration_mult_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_short_reign_duration_mult_2_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_short_reign_duration_mult_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_short_reign_duration_mult_4_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_short_reign_duration_mult_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_short_reign_duration_mult_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_short_reign_duration_mult_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_short_reign_duration_mult_8_modifier
					}
				}
			}
		}

		# Dynasty Opinion
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_dynasty_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_dynasty_opinion_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_dynasty_opinion_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_dynasty_opinion_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_dynasty_opinion_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_dynasty_opinion_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_dynasty_opinion_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_dynasty_opinion_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_dynasty_opinion_8_modifier
					}
				}
			}
		}

		# Dynasty Prestige
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_dynasty_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_prestige_add_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_prestige_add_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_prestige_add_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_prestige_add_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_prestige_add_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_prestige_add_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_prestige_add_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_prestige_add_8_modifier
					}
				}
			}
		}

		# Dynasty Prestige Mult
		20 = {
			trigger = {
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_dynasty_prestige_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_dynasty_prestige_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_dynasty_prestige_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_dynasty_prestige_4_modifier
					}
				}
			}
		}

		# Extra Prestige Gain
		20 = {
			random_list = {
				50 = { # Prestige per Dread
					modifier = {
						exists = scope:inspiration_owner
						scope:inspiration_owner = { has_variable = chosen_dread_mod }
						add = 160
					}
					if = {
						limit = { rarity = common }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_1_modifier
					}
					else_if = {
						limit = { rarity = masterwork }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_2_modifier
					}
					else_if = {
						limit = { rarity = famed }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_3_modifier
					}
					else_if = {
						limit = { rarity = illustrious }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_4_modifier
					}
				}
				50 = { # Prestige per Knight
					if = {
						limit = { rarity = common }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_knight_add_1_modifier
					}
					else_if = {
						limit = { rarity = masterwork }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_knight_add_2_modifier
					}
					else_if = {
						limit = { rarity = famed }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_knight_add_3_modifier
					}
					else_if = {
						limit = { rarity = illustrious }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_knight_add_4_modifier
					}
				}
				50 = { # Prestige per Powerful Vassal
					if = {
						limit = { rarity = common }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_1_modifier
					}
					else_if = {
						limit = { rarity = masterwork }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_2_modifier
					}
					else_if = {
						limit = { rarity = famed }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_3_modifier
					}
					else_if = {
						limit = { rarity = illustrious }
						add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_4_modifier
					}
				}
			}
		}

		# Tyranny Decay
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_dread_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_tyranny_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_tyranny_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_tyranny_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_tyranny_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_tyranny_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_tyranny_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_tyranny_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_monthly_tyranny_8_modifier
					}
				}
			}
		}

		# happy_powerful_vassal_tax_contribution_mult
		20 = {
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_8_modifier
					}
				}
			}
		}

		# courtly_tax_contribution_mult
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_courtly_tax_contribution_mult_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_courtly_tax_contribution_mult_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_courtly_tax_contribution_mult_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_courtly_tax_contribution_mult_4_modifier
			}
		}

		# glory_hound_tax_contribution_mult
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_glory_hound_tax_contribution_mult_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_glory_hound_tax_contribution_mult_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_glory_hound_tax_contribution_mult_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_glory_hound_tax_contribution_mult_4_modifier
			}
		}

		# mercenary_hire_cost_mult
		20 = {
			trigger = {
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_mercenary_hire_cost_mult_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_mercenary_hire_cost_mult_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_mercenary_hire_cost_mult_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_mercenary_hire_cost_mult_4_modifier
					}
				}
			}
		}

		# courtly_opinion
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_courtly_vassal_opinion_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_courtly_vassal_opinion_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_courtly_vassal_opinion_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_courtly_vassal_opinion_4_modifier
			}
		}

		# glory_hound_opinion
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_glory_hound_vassal_opinion_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_glory_hound_vassal_opinion_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_glory_hound_vassal_opinion_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_glory_hound_vassal_opinion_4_modifier
			}
		}

		# vassal_tax_contribution_mult
		20 = {
			trigger = {
				rarity = illustrious
			}
			random_list = {
				20 = {
					add_artifact_modifier = artifact_vassal_tax_contribution_mult_2_modifier
				}
				10 = {
					add_artifact_modifier = artifact_vassal_tax_contribution_mult_4_modifier
				}
			}
		}

		# general_opinion
		20 = {
			trigger = {
				rarity = illustrious
			}
			add_artifact_modifier = artifact_general_opinion_1_modifier
		}

		# Diplomacy per Prestige Level
		20 = {
			trigger = {
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			add_artifact_modifier = artifact_diplomacy_per_prestige_level_modifier
		}
	}
}

add_scaled_artifact_modifier_rulership_effect = {
	random_list = {
		# Vassal Limit
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_vassals_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_vassal_limit_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_vassal_limit_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_vassal_limit_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_vassal_limit_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_vassal_limit_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_vassal_limit_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_vassal_limit_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_vassal_limit_8_modifier
					}
				}
			}
		}

		# Powerful Vassal Opinion
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_vassals_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_powerful_vassal_opinion_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_powerful_vassal_opinion_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_powerful_vassal_opinion_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_powerful_vassal_opinion_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_powerful_vassal_opinion_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_powerful_vassal_opinion_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_powerful_vassal_opinion_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_powerful_vassal_opinion_8_modifier
					}
				}
			}
		}

		# courtly_opinion
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_vassals_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_courtly_vassal_opinion_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_courtly_vassal_opinion_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_courtly_vassal_opinion_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_courtly_vassal_opinion_4_modifier
			}
		}

		# parochial_opinion
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_vassals_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_parochial_vassal_opinion_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_parochial_vassal_opinion_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_parochial_vassal_opinion_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_parochial_vassal_opinion_4_modifier
			}
		}

		# belligerent_opinion
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_belligerent_vassal_opinion_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_belligerent_vassal_opinion_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_belligerent_vassal_opinion_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_belligerent_vassal_opinion_4_modifier
			}
		}

		# Independent Ruler Opinion
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_ind_ruler_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_independent_ruler_opinion_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_independent_ruler_opinion_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_independent_ruler_opinion_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_independent_ruler_opinion_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_independent_ruler_opinion_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_independent_ruler_opinion_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_independent_ruler_opinion_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_independent_ruler_opinion_8_modifier
					}
				}
			}
		}

		# Courtier and Guest Opinion
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_court_op_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_courtier_and_guest_opinion_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_courtier_and_guest_opinion_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_courtier_and_guest_opinion_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_courtier_and_guest_opinion_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_courtier_and_guest_opinion_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_courtier_and_guest_opinion_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_courtier_and_guest_opinion_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_courtier_and_guest_opinion_8_modifier
					}
				}
			}
		}

		# men_at_arms_maintenance
		20 = {
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_men_at_arms_maintenance_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_men_at_arms_maintenance_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_men_at_arms_maintenance_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_men_at_arms_maintenance_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_men_at_arms_maintenance_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_men_at_arms_maintenance_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_men_at_arms_maintenance_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_men_at_arms_maintenance_8_modifier
					}
				}
			}
		}

		# build_gold_cost
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_build_gold_cost_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_build_gold_cost_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_build_gold_cost_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_build_gold_cost_4_modifier
			}
		}

		# domain_tax_mult
		20 = {
			trigger = {
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_domain_tax_mult_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_domain_tax_mult_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_domain_tax_mult_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_domain_tax_mult_4_modifier
					}
				}
			}
		}

		# parochial_tax_contribution_mult
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_parochial_tax_contribution_mult_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_parochial_tax_contribution_mult_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_parochial_tax_contribution_mult_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_parochial_tax_contribution_mult_4_modifier
			}
		}

		# belligerent_tax_contribution_mult
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_belligerent_tax_contribution_mult_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_belligerent_tax_contribution_mult_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_belligerent_tax_contribution_mult_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_belligerent_tax_contribution_mult_4_modifier
			}
		}

		# Stewardship per Stress Level
		20 = {
			trigger = {
				artifact_slot_type = helmet
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = {
					rarity = illustrious
				}
				add_artifact_modifier = artifact_stewardship_per_stress_level_2_modifier
			}
			else = {
				add_artifact_modifier = artifact_stewardship_per_stress_level_1_modifier
			}
		}

		# herd_gain_mult
		20 = {
			trigger = {
				scope:liege ?= { government_has_flag = government_is_nomadic }
			}
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_herd_gain_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_herd_gain_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_herd_gain_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_herd_gain_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_herd_gain_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_herd_gain_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_herd_gain_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_herd_gain_8_modifier
					}
				}
			}
		}

		# herd_conversion
		20 = {
			trigger = {
				scope:liege ?= { government_has_flag = government_is_nomadic }
			}
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_herd_conversion_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_herd_conversion_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_herd_conversion_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_herd_conversion_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_herd_conversion_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_herd_conversion_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_herd_conversion_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_herd_conversion_8_modifier
					}
				}
			}
		}

		# Domain Limit
		#20 = {
			#trigger = {
				#rarity = illustrious
			#}
			#add_artifact_modifier = artifact_domain_limit_1_modifier
		#}
	}
}

add_2_scaled_artifact_modifier_rulership_effect = {
	random_list = {
		pick = 2
		unique = yes
		# Vassal Limit
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_vassals_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_vassal_limit_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_vassal_limit_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_vassal_limit_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_vassal_limit_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_vassal_limit_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_vassal_limit_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_vassal_limit_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_vassal_limit_8_modifier
					}
				}
			}
		}

		# Powerful Vassal Opinion
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_vassals_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_powerful_vassal_opinion_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_powerful_vassal_opinion_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_powerful_vassal_opinion_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_powerful_vassal_opinion_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_powerful_vassal_opinion_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_powerful_vassal_opinion_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_powerful_vassal_opinion_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_powerful_vassal_opinion_8_modifier
					}
				}
			}
		}

		# courtly_opinion
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_vassals_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_courtly_vassal_opinion_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_courtly_vassal_opinion_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_courtly_vassal_opinion_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_courtly_vassal_opinion_4_modifier
			}
		}

		# parochial_opinion
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_vassals_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_parochial_vassal_opinion_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_parochial_vassal_opinion_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_parochial_vassal_opinion_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_parochial_vassal_opinion_4_modifier
			}
		}

		# belligerent_opinion
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_belligerent_vassal_opinion_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_belligerent_vassal_opinion_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_belligerent_vassal_opinion_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_belligerent_vassal_opinion_4_modifier
			}
		}

		# Independent Ruler Opinion
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_ind_ruler_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_independent_ruler_opinion_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_independent_ruler_opinion_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_independent_ruler_opinion_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_independent_ruler_opinion_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_independent_ruler_opinion_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_independent_ruler_opinion_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_independent_ruler_opinion_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_independent_ruler_opinion_8_modifier
					}
				}
			}
		}

		# Courtier and Guest Opinion
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_court_op_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_courtier_and_guest_opinion_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_courtier_and_guest_opinion_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_courtier_and_guest_opinion_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_courtier_and_guest_opinion_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_courtier_and_guest_opinion_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_courtier_and_guest_opinion_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_courtier_and_guest_opinion_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_courtier_and_guest_opinion_8_modifier
					}
				}
			}
		}

		# men_at_arms_maintenance
		20 = {
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_men_at_arms_maintenance_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_men_at_arms_maintenance_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_men_at_arms_maintenance_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_men_at_arms_maintenance_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_men_at_arms_maintenance_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_men_at_arms_maintenance_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_men_at_arms_maintenance_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_men_at_arms_maintenance_8_modifier
					}
				}
			}
		}

		# build_gold_cost
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_build_gold_cost_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_build_gold_cost_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_build_gold_cost_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_build_gold_cost_4_modifier
			}
		}

		# domain_tax_mult
		20 = {
			trigger = {
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_domain_tax_mult_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_domain_tax_mult_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_domain_tax_mult_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_domain_tax_mult_4_modifier
					}
				}
			}
		}

		# parochial_tax_contribution_mult
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_parochial_tax_contribution_mult_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_parochial_tax_contribution_mult_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_parochial_tax_contribution_mult_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_parochial_tax_contribution_mult_4_modifier
			}
		}

		# belligerent_tax_contribution_mult
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_belligerent_tax_contribution_mult_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_belligerent_tax_contribution_mult_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_belligerent_tax_contribution_mult_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_belligerent_tax_contribution_mult_4_modifier
			}
		}

		# Stewardship per Stress Level
		20 = {
			trigger = {
				NOT = { rarity = common }
			}
			if = {
				limit = {
					rarity = illustrious
				}
				add_artifact_modifier = artifact_stewardship_per_stress_level_2_modifier
			}
			else = {
				add_artifact_modifier = artifact_stewardship_per_stress_level_1_modifier
			}
		}

		# herd_gain_mult
		20 = {
			trigger = {
				scope:liege ?= { government_has_flag = government_is_nomadic }
			}
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_herd_gain_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_herd_gain_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_herd_gain_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_herd_gain_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_herd_gain_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_herd_gain_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_herd_gain_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_herd_gain_8_modifier
					}
				}
			}
		}

		# herd_conversion
		20 = {
			trigger = {
				scope:liege ?= { government_has_flag = government_is_nomadic }
			}
			if = {
				limit = { rarity = common }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_herd_conversion_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_herd_conversion_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = masterwork }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_herd_conversion_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_herd_conversion_4_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_herd_conversion_5_modifier
					}
					10 = {
						add_artifact_modifier = artifact_herd_conversion_6_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_herd_conversion_7_modifier
					}
					10 = {
						add_artifact_modifier = artifact_herd_conversion_8_modifier
					}
				}
			}
		}

		# Domain Limit
		#20 = {
			#trigger = {
				#rarity = illustrious
			#}
			#add_artifact_modifier = artifact_domain_limit_1_modifier
		#}
	}
}

add_scaled_artifact_modifier_devotion_effect = {
	random_list = {
		# monthly_piety
		20 = {
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_2_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_3_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_4_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_5_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_8_modifier
					}
				}
			}
		}
		# monthly_piety_gain_mult
		20 = {
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_12_modifier
					}
				}
			}
		}
		# same_faith_opinion
		20 = {
			trigger = {
				rarity = illustrious
			}
			if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_same_faith_opinion_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_same_faith_opinion_2_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_same_faith_opinion_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_same_faith_opinion_4_modifier
					}
				}
			}
		}
		# zealot_opinion
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_zealot_vassal_opinion_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_zealot_vassal_opinion_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_zealot_vassal_opinion_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_zealot_vassal_opinion_4_modifier
			}
		}
		# clergy_opinion
		20 = {
			trigger = {
				scope:owner.faith = {
					NOT = {
						has_doctrine = doctrine_theocracy_lay_clergy
					}
				}
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_clergy_opinion_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_clergy_opinion_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_clergy_opinion_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_clergy_opinion_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_clergy_opinion_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_clergy_opinion_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_clergy_opinion_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_clergy_opinion_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_clergy_opinion_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_clergy_opinion_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_clergy_opinion_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_clergy_opinion_12_modifier
					}
				}
			}
		}
		# church_holding_build_gold_cost
		20 = {
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_12_modifier
					}
				}
			}
		}
		# different_faith_opinion
		20 = {
			trigger = {
				scope:owner.faith = {
					has_doctrine = doctrine_pluralism_pluralistic
				}
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_different_faith_opinion_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_different_faith_opinion_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_different_faith_opinion_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_different_faith_opinion_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_different_faith_opinion_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_different_faith_opinion_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_different_faith_opinion_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_different_faith_opinion_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_different_faith_opinion_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_different_faith_opinion_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_different_faith_opinion_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_different_faith_opinion_12_modifier
					}
				}
			}
		}
		# monthly_piety_from_buildings_mult
		20 = {
			trigger = {
				scope:owner.faith = {
					has_doctrine = doctrine_theocracy_lay_clergy
				}
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_12_modifier
					}
				}
			}
		}
		# domain_tax_same_faith_mult
		20 = {
			trigger = {
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_domain_tax_same_faith_mult_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_domain_tax_same_faith_mult_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_domain_tax_same_faith_mult_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_domain_tax_same_faith_mult_4_modifier
					}
				}
			}
		}
		# monthly_piety_gain_per_happy_powerful_vassal_add
		20 = {
			trigger = {
				scope:owner = {
					faith = {
						has_doctrine = doctrine_pluralism_pluralistic
					}
				}
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_monthly_piety_gain_per_happy_powerful_vassal_add_1_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_monthly_piety_gain_per_happy_powerful_vassal_add_2_modifier
			}
		}
		# monthly_piety_gain_per_happy_powerful_vassal_add
		20 = {
			trigger = {
				scope:owner = {
					faith = {
						has_doctrine = doctrine_pluralism_pluralistic
					}
				}
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_monthly_piety_gain_per_happy_powerful_vassal_add_1_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_monthly_piety_gain_per_happy_powerful_vassal_add_2_modifier
			}
		}
		# monthly_piety_gain_per_knight_add
		20 = {
			trigger = {
				scope:owner = {
					faith = {
						NOR = {
							has_doctrine = doctrine_pluralism_pluralistic
							has_doctrine_parameter = pacifist_opinion_active
						}
					}
				}
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_monthly_piety_gain_per_knight_add_1_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_monthly_piety_gain_per_knight_add_2_modifier
			}
		}
		# zealot_tax_contribution_mult
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_zealot_tax_contribution_mult_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_zealot_tax_contribution_mult_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_zealot_tax_contribution_mult_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_zealot_tax_contribution_mult_4_modifier
			}
		}
		# learning_per_piety_level
		20 = {
			trigger = {
				rarity = illustrious
			}
			add_artifact_modifier = artifact_learning_per_piety_level_modifier
		}
	}
}

add_2_scaled_artifact_modifier_devotion_effect = {
	random_list = {
		pick = 2
		unique = yes
		# monthly_piety
		20 = {
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_2_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_3_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_4_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_5_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_8_modifier
					}
				}
			}
		}
		# monthly_piety_gain_mult
		20 = {
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_monthly_piety_gain_mult_12_modifier
					}
				}
			}
		}
		# same_faith_opinion
		20 = {
			trigger = {
				rarity = illustrious
			}
			if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_same_faith_opinion_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_same_faith_opinion_2_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_same_faith_opinion_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_same_faith_opinion_4_modifier
					}
				}
			}
		}
		# zealot_opinion
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_zealot_vassal_opinion_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_zealot_vassal_opinion_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_zealot_vassal_opinion_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_zealot_vassal_opinion_4_modifier
			}
		}
		# clergy_opinion
		20 = {
			trigger = {
				scope:owner.faith = {
					NOT = {
						has_doctrine = doctrine_theocracy_lay_clergy
					}
				}
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_clergy_opinion_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_clergy_opinion_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_clergy_opinion_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_clergy_opinion_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_clergy_opinion_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_clergy_opinion_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_clergy_opinion_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_clergy_opinion_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_clergy_opinion_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_clergy_opinion_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_clergy_opinion_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_clergy_opinion_12_modifier
					}
				}
			}
		}
		# church_holding_build_gold_cost
		20 = {
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_church_holding_build_gold_cost_12_modifier
					}
				}
			}
		}
		# different_faith_opinion
		20 = {
			trigger = {
				scope:owner.faith = {
					has_doctrine = doctrine_pluralism_pluralistic
				}
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_different_faith_opinion_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_different_faith_opinion_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_different_faith_opinion_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_different_faith_opinion_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_different_faith_opinion_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_different_faith_opinion_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_different_faith_opinion_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_different_faith_opinion_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_different_faith_opinion_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_different_faith_opinion_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_different_faith_opinion_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_different_faith_opinion_12_modifier
					}
				}
			}
		}
		# monthly_piety_from_buildings_mult
		20 = {
			trigger = {
				scope:owner.faith = {
					has_doctrine = doctrine_theocracy_lay_clergy
				}
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_12_modifier
					}
				}
			}
		}
		# domain_tax_same_faith_mult
		20 = {
			trigger = {
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = { rarity = famed }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_domain_tax_same_faith_mult_1_modifier
					}
					10 = {
						add_artifact_modifier = artifact_domain_tax_same_faith_mult_2_modifier
					}
				}
			}
			else_if = {
				limit = { rarity = illustrious }
				random_list = {
					20 = {
						add_artifact_modifier = artifact_domain_tax_same_faith_mult_3_modifier
					}
					10 = {
						add_artifact_modifier = artifact_domain_tax_same_faith_mult_4_modifier
					}
				}
			}
		}
		# monthly_piety_gain_per_happy_powerful_vassal_add
		20 = {
			trigger = {
				scope:owner = {
					faith = {
						has_doctrine = doctrine_pluralism_pluralistic
					}
				}
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_monthly_piety_gain_per_happy_powerful_vassal_add_1_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_monthly_piety_gain_per_happy_powerful_vassal_add_2_modifier
			}
		}
		# monthly_piety_gain_per_happy_powerful_vassal_add
		20 = {
			trigger = {
				scope:owner = {
					faith = {
						has_doctrine = doctrine_pluralism_pluralistic
					}
				}
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_monthly_piety_gain_per_happy_powerful_vassal_add_1_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_monthly_piety_gain_per_happy_powerful_vassal_add_2_modifier
			}
		}
		# monthly_piety_gain_per_knight_add
		20 = {
			trigger = {
				scope:owner = {
					faith = {
						NOR = {
							has_doctrine = doctrine_pluralism_pluralistic
							has_doctrine_parameter = pacifist_opinion_active
						}
					}
				}
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_monthly_piety_gain_per_knight_add_1_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_monthly_piety_gain_per_knight_add_2_modifier
			}
		}
		# zealot_tax_contribution_mult
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_zealot_tax_contribution_mult_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_zealot_tax_contribution_mult_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_zealot_tax_contribution_mult_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_zealot_tax_contribution_mult_4_modifier
			}
		}
		# learning_per_piety_level
		20 = {
			trigger = {
				rarity = illustrious
			}
			add_artifact_modifier = artifact_learning_per_piety_level_modifier
		}
	}
}

add_scaled_artifact_modifier_intrigue_effect = {
	random_list = {

		# owned_hostile_scheme_success_chance_add
		20 = {
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_12_modifier
					}
				}
			}
		}
		# owned_personal_scheme_success_chance_add
		20 = {
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_12_modifier
					}
				}
			}
		}
		# owned_scheme_secrecy_add
		20 = {
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_12_modifier
					}
				}
			}
		}
		# hostile_scheme_phase_duration_add
		20 = {
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_12_modifier
					}
				}
			}
		}
		# personal_scheme_phase_duration_add
		20 = {
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_12_modifier
					}
				}
			}
		}

		# intrigue_per_stress_level
		20 = {
			trigger = {
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = {
					rarity = famed
				}
				add_artifact_modifier = artifact_intrigue_per_stress_level_1_modifier
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				add_artifact_modifier = artifact_intrigue_per_stress_level_2_modifier
			}
		}
	}
}

add_2_scaled_artifact_modifier_intrigue_effect = {
	random_list = {
		pick = 2
		unique = yes
		# owned_hostile_scheme_success_chance_add
		20 = {
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_12_modifier
					}
				}
			}
		}
		# owned_personal_scheme_success_chance_add
		20 = {
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_12_modifier
					}
				}
			}
		}
		# owned_scheme_secrecy_add
		20 = {
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_owned_scheme_secrecy_add_12_modifier
					}
				}
			}
		}
		# hostile_scheme_phase_duration_add
		20 = {
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_12_modifier
					}
				}
			}
		}
		# personal_scheme_phase_duration_add
		20 = {
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_personal_scheme_phase_duration_add_12_modifier
					}
				}
			}
		}

		# intrigue_per_stress_level
		20 = {
			trigger = {
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			if = {
				limit = {
					rarity = famed
				}
				add_artifact_modifier = artifact_intrigue_per_stress_level_1_modifier
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				add_artifact_modifier = artifact_intrigue_per_stress_level_2_modifier
			}
		}
	}
}

add_scaled_artifact_modifier_attractiveness_effect = {
	random_list = {
		# attraction_opinion
		20 = {
			modifier = {
				exists = scope:inspiration_owner
				scope:inspiration_owner = { has_variable = chosen_attraction_mod }
				add = 160
			}
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_attraction_opinion_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_attraction_opinion_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_attraction_opinion_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_attraction_opinion_4_modifier
			}
		}
		# fertility
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_fertility_gain_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_fertility_gain_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_fertility_gain_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_fertility_gain_4_modifier
			}
		}
		# courting_scheme_phase_duration_add
		15 = {
			trigger = {
				scope:owner = {
					diplomacy >= intrigue
				}
			}
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_courting_scheme_phase_duration_add_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_courting_scheme_phase_duration_add_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_courting_scheme_phase_duration_add_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_courting_scheme_phase_duration_add_4_modifier
			}
		}
		# befriend_scheme_phase_duration_add
		5 = {
			trigger = {
				scope:owner = { intrigue <= low_skill_rating }
			}
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_befriend_scheme_phase_duration_add_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_befriend_scheme_phase_duration_add_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_befriend_scheme_phase_duration_add_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_befriend_scheme_phase_duration_add_4_modifier
			}
		}
		# seduce_scheme_phase_duration_add
		20 = {
			trigger = {
				scope:owner = {
					intrigue >= diplomacy
				}
			}
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_seduce_scheme_phase_duration_add_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_seduce_scheme_phase_duration_add_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_seduce_scheme_phase_duration_add_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_seduce_scheme_phase_duration_add_4_modifier
			}
		}
		# spouse_opinion
		20 = {
			trigger = {
				scope:owner = {
					is_married = yes
				}
			}
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_spouse_opinion_add_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_spouse_opinion_add_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_spouse_opinion_add_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_spouse_opinion_add_4_modifier
			}
		}
	}
}

add_scaled_artifact_modifier_scholarship_effect = {
	random_list = {
		# development_growth
		20 = {
			trigger = {
				artifact_owner ?= { NOT = { government_has_flag = government_is_nomadic } } 
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_development_growth_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_development_growth_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_development_growth_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_development_growth_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_development_growth_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_development_growth_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_development_growth_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_development_growth_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_development_growth_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_development_growth_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_development_growth_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_development_growth_12_modifier
					}
				}
			}
		}
		# fertility_growth
		20 = {
			trigger = {
				artifact_owner ?= { government_has_flag = government_is_nomadic } 
			}
			if = {
				limit = {
					rarity = common
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_fertility_growth_1_modifier
					}
					15 = {
						add_artifact_modifier = artifact_fertility_growth_2_modifier
					}
					5 = {
						add_artifact_modifier = artifact_fertility_growth_3_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_fertility_growth_4_modifier
					}
					15 = {
						add_artifact_modifier = artifact_fertility_growth_5_modifier
					}
					5 = {
						add_artifact_modifier = artifact_fertility_growth_6_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = famed
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_fertility_growth_7_modifier
					}
					15 = {
						add_artifact_modifier = artifact_fertility_growth_8_modifier
					}
					5 = {
						add_artifact_modifier = artifact_fertility_growth_9_modifier
					}
				}
			}
			else_if = {
				limit = {
					rarity = illustrious
				}
				random_list = {
					20 = {
						add_artifact_modifier = artifact_fertility_growth_10_modifier
					}
					15 = {
						add_artifact_modifier = artifact_fertility_growth_11_modifier
					}
					5 = {
						add_artifact_modifier = artifact_fertility_growth_12_modifier
					}
				}
			}
		}
		# learn_language_scheme_phase_duration_add
		20 = {
			if = {
				limit = { rarity = common }
				add_artifact_modifier = artifact_learn_language_scheme_phase_duration_add_1_modifier
			}
			else_if = {
				limit = { rarity = masterwork }
				add_artifact_modifier = artifact_learn_language_scheme_phase_duration_add_2_modifier
			}
			else_if = {
				limit = { rarity = famed }
				add_artifact_modifier = artifact_learn_language_scheme_phase_duration_add_3_modifier
			}
			else_if = {
				limit = { rarity = illustrious }
				add_artifact_modifier = artifact_learn_language_scheme_phase_duration_add_4_modifier
			}
		}

		# Learning per Prestige Level
		20 = {
			trigger = {
				OR = {
					rarity = famed
					rarity = illustrious
				}
			}
			add_artifact_modifier = artifact_learning_per_prestige_level_modifier
		}
	}
}

add_scaled_artifact_modifier_learning_lifestyle_xp_effect = {
	if = {
		limit = { rarity = common }
		random_list = {
			20 = { add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_1_modifier }
			5 = { add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_2_modifier }
		}
	}
	else_if = {
		limit = { rarity = masterwork }
		random_list = {
			20 = { add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_2_modifier }
			5 = { add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_3_modifier }
		}
	}
	else_if = {
		limit = { rarity = famed }
		random_list = {
			20 = { add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_3_modifier }
			5 = { add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_4_modifier }
		}
	}
	else_if = {
		limit = { rarity = illustrious }
		add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_4_modifier
	}
}

# EP2

add_scaled_artifact_modifier_archers_screen_add_effect = {
	if = {
		limit = { rarity = common }
		random_list = {
			20 = { add_artifact_modifier = artifact_archers_screen_add_1_modifier }
			5 = { add_artifact_modifier = artifact_archers_screen_add_2_modifier }
		}
	}
	else_if = {
		limit = { rarity = masterwork }
		random_list = {
			20 = { add_artifact_modifier = artifact_archers_screen_add_2_modifier }
			5 = { add_artifact_modifier = artifact_archers_screen_add_3_modifier }
		}
	}
	else_if = {
		limit = { rarity = famed }
		random_list = {
			20 = { add_artifact_modifier = artifact_archers_screen_add_3_modifier }
			5 = { add_artifact_modifier = artifact_archers_screen_add_4_modifier }
		}
	}
	else_if = {
		limit = { rarity = illustrious }
		add_artifact_modifier = artifact_archers_screen_add_4_modifier
	}
}

add_scaled_artifact_modifier_archers_toughness_mult_effect = {
	if = {
		limit = { rarity = common }
		random_list = {
			20 = { add_artifact_modifier = artifact_archers_toughness_mult_1_modifier }
			5 = { add_artifact_modifier = artifact_archers_toughness_mult_2_modifier }
		}
	}
	else_if = {
		limit = { rarity = masterwork }
		random_list = {
			20 = { add_artifact_modifier = artifact_archers_toughness_mult_2_modifier }
			5 = { add_artifact_modifier = artifact_archers_toughness_mult_3_modifier }
		}
	}
	else_if = {
		limit = { rarity = famed }
		random_list = {
			20 = { add_artifact_modifier = artifact_archers_toughness_mult_3_modifier }
			5 = { add_artifact_modifier = artifact_archers_toughness_mult_4_modifier }
		}
	}
	else_if = {
		limit = { rarity = illustrious }
		add_artifact_modifier = artifact_archers_toughness_mult_4_modifier
	}
}

add_scaled_artifact_modifier_archer_cavalry_screen_add_effect = {
	if = {
		limit = { rarity = common }
		random_list = {
			20 = { add_artifact_modifier = artifact_archer_cavalry_screen_add_1_modifier }
			5 = { add_artifact_modifier = artifact_archer_cavalry_screen_add_2_modifier }
		}
	}
	else_if = {
		limit = { rarity = masterwork }
		random_list = {
			20 = { add_artifact_modifier = artifact_archer_cavalry_screen_add_2_modifier }
			5 = { add_artifact_modifier = artifact_archer_cavalry_screen_add_3_modifier }
		}
	}
	else_if = {
		limit = { rarity = famed }
		random_list = {
			20 = { add_artifact_modifier = artifact_archer_cavalry_screen_add_3_modifier }
			5 = { add_artifact_modifier = artifact_archer_cavalry_screen_add_4_modifier }
		}
	}
	else_if = {
		limit = { rarity = illustrious }
		add_artifact_modifier = artifact_archer_cavalry_screen_add_4_modifier
	}
}

add_scaled_artifact_modifier_archer_cavalry_damage_add_effect = {
	if = {
		limit = { rarity = common }
		random_list = {
			20 = { add_artifact_modifier = artifact_archer_cavalry_damage_add_1_modifier }
			5 = { add_artifact_modifier = artifact_archer_cavalry_damage_add_2_modifier }
		}
	}
	else_if = {
		limit = { rarity = masterwork }
		random_list = {
			20 = { add_artifact_modifier = artifact_archer_cavalry_damage_add_2_modifier }
			5 = { add_artifact_modifier = artifact_archer_cavalry_damage_add_3_modifier }
		}
	}
	else_if = {
		limit = { rarity = famed }
		random_list = {
			20 = { add_artifact_modifier = artifact_archer_cavalry_damage_add_3_modifier }
			5 = { add_artifact_modifier = artifact_archer_cavalry_damage_add_4_modifier }
		}
	}
	else_if = {
		limit = { rarity = illustrious }
		add_artifact_modifier = artifact_archer_cavalry_damage_add_4_modifier
	}
}

add_scaled_artifact_modifier_stress_gain_effect = {
	switch = {
		trigger = rarity
		common = { add_artifact_modifier = artifact_stress_gain_1_modifier }
		masterwork = { add_artifact_modifier = artifact_stress_gain_2_modifier }
		famed = { add_artifact_modifier = artifact_stress_gain_3_modifier }
		illustrious = { add_artifact_modifier = artifact_stress_gain_4_modifier }
	}
}

#EP3

add_scaled_artifact_modifier_terrain_advantage_effect = {
	#Plains
	if = {
		limit = { 
			artifact_owner.location ?= { terrain = plains } 
		}
		if = {
			limit = { rarity = common }
			random_list = {
				20 = { add_artifact_modifier = artifact_plains_advantage_1_modifier }
				5 = { add_artifact_modifier = artifact_plains_advantage_2_modifier }
			}
		}
		else_if = {
			limit = { rarity = masterwork }
			random_list = {
				20 = { add_artifact_modifier = artifact_plains_advantage_2_modifier }
				5 = { add_artifact_modifier = artifact_plains_advantage_3_modifier }
			}
		}
		else_if = {
			limit = { rarity = famed }
			random_list = {
				20 = { add_artifact_modifier = artifact_plains_advantage_3_modifier }
				5 = { add_artifact_modifier = artifact_plains_advantage_4_modifier }
			}
		}
		else_if = {
			limit = { rarity = illustrious }
			add_artifact_modifier = artifact_plains_advantage_4_modifier
		}
	}
	#Farmlands
	if = {
		limit = { 
			artifact_owner.location ?= { terrain = farmlands } 
		}
		if = {
			limit = { rarity = common }
			random_list = {
				20 = { add_artifact_modifier = artifact_farmlands_advantage_1_modifier }
				5 = { add_artifact_modifier = artifact_farmlands_advantage_2_modifier }
			}
		}
		else_if = {
			limit = { rarity = masterwork }
			random_list = {
				20 = { add_artifact_modifier = artifact_farmlands_advantage_2_modifier }
				5 = { add_artifact_modifier = artifact_farmlands_advantage_3_modifier }
			}
		}
		else_if = {
			limit = { rarity = famed }
			random_list = {
				20 = { add_artifact_modifier = artifact_farmlands_advantage_3_modifier }
				5 = { add_artifact_modifier = artifact_farmlands_advantage_4_modifier }
			}
		}
		else_if = {
			limit = { rarity = illustrious }
			add_artifact_modifier = artifact_farmlands_advantage_4_modifier
		}
	}
	#Hills
	if = {
		limit = { 
			artifact_owner.location ?= { terrain = hills } 
		}
		if = {
			limit = { rarity = common }
			random_list = {
				20 = { add_artifact_modifier = artifact_hills_advantage_1_modifier }
				5 = { add_artifact_modifier = artifact_hills_advantage_2_modifier }
			}
		}
		else_if = {
			limit = { rarity = masterwork }
			random_list = {
				20 = { add_artifact_modifier = artifact_hills_advantage_2_modifier }
				5 = { add_artifact_modifier = artifact_hills_advantage_3_modifier }
			}
		}
		else_if = {
			limit = { rarity = famed }
			random_list = {
				20 = { add_artifact_modifier = artifact_hills_advantage_3_modifier }
				5 = { add_artifact_modifier = artifact_hills_advantage_4_modifier }
			}
		}
		else_if = {
			limit = { rarity = illustrious }
			add_artifact_modifier = artifact_hills_advantage_4_modifier
		}
	}
	#Mountains
	if = {
		limit = { 
			artifact_owner.location ?= { terrain = mountains } 
		}
		if = {
			limit = { rarity = common }
			random_list = {
				20 = { add_artifact_modifier = artifact_mountains_advantage_1_modifier }
				5 = { add_artifact_modifier = artifact_mountains_advantage_2_modifier }
			}
		}
		else_if = {
			limit = { rarity = masterwork }
			random_list = {
				20 = { add_artifact_modifier = artifact_mountains_advantage_2_modifier }
				5 = { add_artifact_modifier = artifact_mountains_advantage_3_modifier }
			}
		}
		else_if = {
			limit = { rarity = famed }
			random_list = {
				20 = { add_artifact_modifier = artifact_mountains_advantage_3_modifier }
				5 = { add_artifact_modifier = artifact_mountains_advantage_4_modifier }
			}
		}
		else_if = {
			limit = { rarity = illustrious }
			add_artifact_modifier = artifact_mountains_advantage_4_modifier
		}
	}
	#Desert
	if = {
		limit = { 
			artifact_owner.location ?= { terrain = desert } 
		}
		if = {
			limit = { rarity = common }
			random_list = {
				20 = { add_artifact_modifier = artifact_desert_advantage_1_modifier }
				5 = { add_artifact_modifier = artifact_desert_advantage_2_modifier }
			}
		}
		else_if = {
			limit = { rarity = masterwork }
			random_list = {
				20 = { add_artifact_modifier = artifact_desert_advantage_2_modifier }
				5 = { add_artifact_modifier = artifact_desert_advantage_3_modifier }
			}
		}
		else_if = {
			limit = { rarity = famed }
			random_list = {
				20 = { add_artifact_modifier = artifact_desert_advantage_3_modifier }
				5 = { add_artifact_modifier = artifact_desert_advantage_4_modifier }
			}
		}
		else_if = {
			limit = { rarity = illustrious }
			add_artifact_modifier = artifact_desert_advantage_4_modifier
		}
	}
	#Desert Mountains
	if = {
		limit = { 
			artifact_owner.location ?= { terrain = desert_mountains } 
		}
		if = {
			limit = { rarity = common }
			random_list = {
				20 = { add_artifact_modifier = artifact_desert_mountains_advantage_1_modifier }
				5 = { add_artifact_modifier = artifact_desert_mountains_advantage_2_modifier }
			}
		}
		else_if = {
			limit = { rarity = masterwork }
			random_list = {
				20 = { add_artifact_modifier = artifact_desert_mountains_advantage_2_modifier }
				5 = { add_artifact_modifier = artifact_desert_mountains_advantage_3_modifier }
			}
		}
		else_if = {
			limit = { rarity = famed }
			random_list = {
				20 = { add_artifact_modifier = artifact_desert_mountains_advantage_3_modifier }
				5 = { add_artifact_modifier = artifact_desert_mountains_advantage_4_modifier }
			}
		}
		else_if = {
			limit = { rarity = illustrious }
			add_artifact_modifier = artifact_desert_mountains_advantage_4_modifier
		}
	}
	#Oasis
	if = {
		limit = { 
			artifact_owner.location ?= { terrain = oasis } 
		}
		if = {
			limit = { rarity = common }
			random_list = {
				20 = { add_artifact_modifier = artifact_oasis_advantage_1_modifier }
				5 = { add_artifact_modifier = artifact_oasis_advantage_2_modifier }
			}
		}
		else_if = {
			limit = { rarity = masterwork }
			random_list = {
				20 = { add_artifact_modifier = artifact_oasis_advantage_2_modifier }
				5 = { add_artifact_modifier = artifact_oasis_advantage_3_modifier }
			}
		}
		else_if = {
			limit = { rarity = famed }
			random_list = {
				20 = { add_artifact_modifier = artifact_oasis_advantage_3_modifier }
				5 = { add_artifact_modifier = artifact_oasis_advantage_4_modifier }
			}
		}
		else_if = {
			limit = { rarity = illustrious }
			add_artifact_modifier = artifact_oasis_advantage_4_modifier
		}
	}
	#Jungle
	if = {
		limit = { 
			artifact_owner.location ?= { terrain = jungle } 
		}
		if = {
			limit = { rarity = common }
			random_list = {
				20 = { add_artifact_modifier = artifact_jungle_advantage_1_modifier }
				5 = { add_artifact_modifier = artifact_jungle_advantage_2_modifier }
			}
		}
		else_if = {
			limit = { rarity = masterwork }
			random_list = {
				20 = { add_artifact_modifier = artifact_jungle_advantage_2_modifier }
				5 = { add_artifact_modifier = artifact_jungle_advantage_3_modifier }
			}
		}
		else_if = {
			limit = { rarity = famed }
			random_list = {
				20 = { add_artifact_modifier = artifact_jungle_advantage_3_modifier }
				5 = { add_artifact_modifier = artifact_jungle_advantage_4_modifier }
			}
		}
		else_if = {
			limit = { rarity = illustrious }
			add_artifact_modifier = artifact_jungle_advantage_4_modifier
		}
	}
	#Forest
	if = {
		limit = { 
			artifact_owner.location ?= { terrain = forest } 
		}
		if = {
			limit = { rarity = common }
			random_list = {
				20 = { add_artifact_modifier = artifact_forest_advantage_1_modifier }
				5 = { add_artifact_modifier = artifact_forest_advantage_2_modifier }
			}
		}
		else_if = {
			limit = { rarity = masterwork }
			random_list = {
				20 = { add_artifact_modifier = artifact_forest_advantage_2_modifier }
				5 = { add_artifact_modifier = artifact_forest_advantage_3_modifier }
			}
		}
		else_if = {
			limit = { rarity = famed }
			random_list = {
				20 = { add_artifact_modifier = artifact_forest_advantage_3_modifier }
				5 = { add_artifact_modifier = artifact_forest_advantage_4_modifier }
			}
		}
		else_if = {
			limit = { rarity = illustrious }
			add_artifact_modifier = artifact_forest_advantage_4_modifier
		}
	}
	#Taiga
	if = {
		limit = { 
			artifact_owner.location ?= { terrain = taiga } 
		}
		if = {
			limit = { rarity = common }
			random_list = {
				20 = { add_artifact_modifier = artifact_taiga_advantage_1_modifier }
				5 = { add_artifact_modifier = artifact_taiga_advantage_2_modifier }
			}
		}
		else_if = {
			limit = { rarity = masterwork }
			random_list = {
				20 = { add_artifact_modifier = artifact_taiga_advantage_2_modifier }
				5 = { add_artifact_modifier = artifact_taiga_advantage_3_modifier }
			}
		}
		else_if = {
			limit = { rarity = famed }
			random_list = {
				20 = { add_artifact_modifier = artifact_taiga_advantage_3_modifier }
				5 = { add_artifact_modifier = artifact_taiga_advantage_4_modifier }
			}
		}
		else_if = {
			limit = { rarity = illustrious }
			add_artifact_modifier = artifact_taiga_advantage_4_modifier
		}
	}
	#Wetlands
	if = {
		limit = { 
			artifact_owner.location ?= { terrain = wetlands } 
		}
		if = {
			limit = { rarity = common }
			random_list = {
				20 = { add_artifact_modifier = artifact_wetlands_advantage_1_modifier }
				5 = { add_artifact_modifier = artifact_wetlands_advantage_2_modifier }
			}
		}
		else_if = {
			limit = { rarity = masterwork }
			random_list = {
				20 = { add_artifact_modifier = artifact_wetlands_advantage_2_modifier }
				5 = { add_artifact_modifier = artifact_wetlands_advantage_3_modifier }
			}
		}
		else_if = {
			limit = { rarity = famed }
			random_list = {
				20 = { add_artifact_modifier = artifact_wetlands_advantage_3_modifier }
				5 = { add_artifact_modifier = artifact_wetlands_advantage_4_modifier }
			}
		}
		else_if = {
			limit = { rarity = illustrious }
			add_artifact_modifier = artifact_wetlands_advantage_4_modifier
		}
	}
	#Steppe
	if = {
		limit = { 
			artifact_owner.location ?= { terrain = steppe } 
		}
		if = {
			limit = { rarity = common }
			random_list = {
				20 = { add_artifact_modifier = artifact_steppe_advantage_1_modifier }
				5 = { add_artifact_modifier = artifact_steppe_advantage_2_modifier }
			}
		}
		else_if = {
			limit = { rarity = masterwork }
			random_list = {
				20 = { add_artifact_modifier = artifact_steppe_advantage_2_modifier }
				5 = { add_artifact_modifier = artifact_steppe_advantage_3_modifier }
			}
		}
		else_if = {
			limit = { rarity = famed }
			random_list = {
				20 = { add_artifact_modifier = artifact_steppe_advantage_3_modifier }
				5 = { add_artifact_modifier = artifact_steppe_advantage_4_modifier }
			}
		}
		else_if = {
			limit = { rarity = illustrious }
			add_artifact_modifier = artifact_steppe_advantage_4_modifier
		}
	}
	#Floodplains
	if = {
		limit = { 
			artifact_owner.location ?= { terrain = floodplains } 
		}
		if = {
			limit = { rarity = common }
			random_list = {
				20 = { add_artifact_modifier = artifact_floodplains_advantage_1_modifier }
				5 = { add_artifact_modifier = artifact_floodplains_advantage_2_modifier }
			}
		}
		else_if = {
			limit = { rarity = masterwork }
			random_list = {
				20 = { add_artifact_modifier = artifact_floodplains_advantage_2_modifier }
				5 = { add_artifact_modifier = artifact_floodplains_advantage_3_modifier }
			}
		}
		else_if = {
			limit = { rarity = famed }
			random_list = {
				20 = { add_artifact_modifier = artifact_floodplains_advantage_3_modifier }
				5 = { add_artifact_modifier = artifact_floodplains_advantage_4_modifier }
			}
		}
		else_if = {
			limit = { rarity = illustrious }
			add_artifact_modifier = artifact_floodplains_advantage_4_modifier
		}
	}
	#Drylands
	if = {
		limit = { 
			artifact_owner.location ?= { terrain = drylands } 
		}
		if = {
			limit = { rarity = common }
			random_list = {
				20 = { add_artifact_modifier = artifact_drylands_advantage_1_modifier }
				5 = { add_artifact_modifier = artifact_drylands_advantage_2_modifier }
			}
		}
		else_if = {
			limit = { rarity = masterwork }
			random_list = {
				20 = { add_artifact_modifier = artifact_drylands_advantage_2_modifier }
				5 = { add_artifact_modifier = artifact_drylands_advantage_3_modifier }
			}
		}
		else_if = {
			limit = { rarity = famed }
			random_list = {
				20 = { add_artifact_modifier = artifact_drylands_advantage_3_modifier }
				5 = { add_artifact_modifier = artifact_drylands_advantage_4_modifier }
			}
		}
		else_if = {
			limit = { rarity = illustrious }
			add_artifact_modifier = artifact_drylands_advantage_4_modifier
		}
	}
}

add_scaled_artifact_modifier_hire_mercenary_effect = {
	if = {
		limit = { rarity = common }
		random_list = {
			20 = { add_artifact_modifier = artifact_mercenary_hire_cost_mult_1_modifier }
			5 = { add_artifact_modifier = artifact_mercenary_hire_cost_mult_2_modifier }
		}
	}
	else_if = {
		limit = { rarity = masterwork }
		random_list = {
			20 = { add_artifact_modifier = artifact_mercenary_hire_cost_mult_2_modifier }
			5 = { add_artifact_modifier = artifact_mercenary_hire_cost_mult_3_modifier }
		}
	}
	else_if = {
		limit = { rarity = famed }
		random_list = {
			20 = { add_artifact_modifier = artifact_mercenary_hire_cost_mult_3_modifier }
			5 = { add_artifact_modifier = artifact_mercenary_hire_cost_mult_4_modifier }
		}
	}
	else_if = {
		limit = { rarity = illustrious }
		add_artifact_modifier = artifact_mercenary_hire_cost_mult_4_modifier
	}
}

add_scaled_artifact_modifier_negate_prowess_penalty_effect = {
	if = {
		limit = { rarity = common }
		random_list = {
			20 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_1_modifier }
			15 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_2_modifier }
			5 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_3_modifier }
		}
	}
	else_if = {
		limit = { rarity = masterwork }
		random_list = {
			20 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_3_modifier }
			15 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_4_modifier }
			5 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_5_modifier }
		}
	}
	else_if = {
		limit = { rarity = famed }
		random_list = {
			20 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_5_modifier }
			15 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_6_modifier }
			5 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_7_modifier }
		}
	}
	else_if = {
		limit = { rarity = illustrious }
		random_list = {
			20 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_7_modifier }
			15 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_8_modifier }
		}
	}
}

add_scaled_artifact_modifier_scheme_resistance_effect = {
	if = {
		limit = { rarity = common }
		random_list = {
			0 = { 
				#No modifier 
			}
			5 = { add_artifact_modifier = artifact_scheme_resistance_add_1_modifier }
		}
	}
	else_if = {
		limit = { rarity = masterwork }
		random_list = {
			20 = { add_artifact_modifier = artifact_scheme_resistance_add_1_modifier }
			5 = { add_artifact_modifier = artifact_scheme_resistance_add_2_modifier }
		}
	}
	else_if = {
		limit = { rarity = famed }
		random_list = {
			20 = { add_artifact_modifier = artifact_scheme_resistance_add_2_modifier }
			5 = { add_artifact_modifier = artifact_scheme_resistance_add_3_modifier }
		}
	}
	else_if = {
		limit = { rarity = illustrious }
		add_artifact_modifier = artifact_scheme_resistance_add_3_modifier
	}
}

#################################################
#												#
# 		WEAPON CREATION AND DECORATION  		#
#												#
#################################################

get_sword_decoration_effect = {
	random_list = {
		40 = {
			trigger = { ep1_extravagant_artifact_decorations_trigger = yes }
			set_artifact_feature_group = blade_decoration
			set_artifact_feature_group = hilt_decoration
		}
		30 = {
			trigger = {	ep1_advanced_artifact_decorations_trigger = yes }
			set_artifact_feature_group = blade_decoration
		}
		20 = {
			trigger = {	ep1_simple_artifact_decorations_trigger = yes }
			set_artifact_feature_group = hilt_decoration
		}
		10 = {
			trigger = {	ep1_no_artifact_decorations_trigger = yes }
			modifier = {
				add = 30
				AND = {
					exists = scope:inspiration_owner
					scope:inspiration_owner = { ai_greed <= -40	}
				}
			}
			# No decoration
		}
	}
}

get_dagger_decoration_effect = {
	get_sword_decoration_effect = yes # Currently identical, but we may wish to diverge these later.
}

# Axes, Hammers, Spears, and Maces
get_axe_decoration_effect = {
	random_list = {
		40 = {
			trigger = { ep1_extravagant_artifact_decorations_trigger = yes }
			set_artifact_feature_group = head_decoration
			set_artifact_feature_group = shaft_decoration
		}
		20 = {
			trigger = {	ep1_advanced_artifact_decorations_trigger = yes }
			set_artifact_feature_group = head_decoration
		}
		40 = {
			trigger = {	ep1_simple_artifact_decorations_trigger = yes }
			set_artifact_feature_group = shaft_decoration
		}
		10 = {
			trigger = {	ep1_no_artifact_decorations_trigger = yes }
			modifier = {
				add = 30
				AND = {
					exists = scope:inspiration_owner
					scope:inspiration_owner = { ai_greed <= -40	}
				}
			}
			# No decoration
		}

	}
}

get_hammer_decoration_effect = {
	random_list = {
		40 = {
			trigger = { ep1_extravagant_artifact_decorations_trigger = yes }
			set_artifact_feature_group = head_decoration
			set_artifact_feature_group = shaft_decoration
		}
		20 = {
			trigger = {	ep1_advanced_artifact_decorations_trigger = yes }
			set_artifact_feature_group = head_decoration
		}
		40 = {
			trigger = {	ep1_simple_artifact_decorations_trigger = yes }
			set_artifact_feature_group = shaft_decoration
		}
		10 = {
			trigger = {	ep1_no_artifact_decorations_trigger = yes }
			modifier = {
				add = 30
				AND = {
					exists = scope:inspiration_owner
					scope:inspiration_owner = { ai_greed <= -40	}
				}
			}
			# No decoration
		}
	}
}

get_spear_decoration_effect = {
	random_list = {
		40 = {
			trigger = { ep1_extravagant_artifact_decorations_trigger = yes }
			set_artifact_feature_group = head_decoration
			set_artifact_feature_group = shaft_decoration
		}
		20 = {
			trigger = {	ep1_advanced_artifact_decorations_trigger = yes }
			set_artifact_feature_group = head_decoration
		}
		40 = {
			trigger = {	ep1_simple_artifact_decorations_trigger = yes }
			set_artifact_feature_group = shaft_decoration
		}
		10 = {
			trigger = {	ep1_no_artifact_decorations_trigger = yes }
			modifier = {
				add = 30
				AND = {
					exists = scope:inspiration_owner
					scope:inspiration_owner = { ai_greed <= -40	}
				}
			}
			# No decoration
		}

	}
}

get_mace_decoration_effect = {
	random_list = {
		40 = {
			trigger = { ep1_extravagant_artifact_decorations_trigger = yes }
			set_artifact_feature_group = head_decoration
			set_artifact_feature_group = metal_handle_decoration
		}
		20 = {
			trigger = {	ep1_advanced_artifact_decorations_trigger = yes }
			set_artifact_feature_group = head_decoration
		}
		20 = {
			trigger = {	ep1_simple_artifact_decorations_trigger = yes }
			set_artifact_feature_group = metal_handle_decoration
		}
		30 = {
			trigger = {	ep1_no_artifact_decorations_trigger = yes }
			modifier = {
				add = 40
				AND = {
					exists = scope:inspiration_owner
					scope:inspiration_owner = { ai_greed <= -40	}
				}
			}
			# No decoration
		}

	}
}

# If the type of weapon hasn't been decided yet we set it here
set_weapon_artifact_type_effect = {
	save_temporary_scope_value_as = {
		name = allow_no_type_option
		value = $NO_TYPE$
	}
	# Historically many of these types of weapon were used in some combination, but to give a clearer portrayal to the player we have to simplify it a bit
	hidden_effect = {
		$BASE_SCOPE$ = {
			#The type has been decided in events, when the character got inspired, or now. Let's save it! (might still leave it up to the sponsor if allow_no_type_option = yes!)
			if = {
				limit = {
					NOT = { exists = var:artifact_weapon_type }
				}
				random_list = { #What weapon do they want to forge?
					0 = { # 10
						set_variable = {
							name = artifact_weapon_type
							value = flag:artifact_weapon_type_axe
						}
					}
					20 = { # 10
						set_variable = {
							name = artifact_weapon_type
							value = flag:artifact_weapon_type_dagger
						}
					}
					0 = { # 10
						set_variable = {
							name = artifact_weapon_type
							value = flag:artifact_weapon_type_hammer
						}
					}
					0 = { # 10
						set_variable = {
							name = artifact_weapon_type
							value = flag:artifact_weapon_type_mace
						}
					}
					20 = { # 10
						set_variable = {
							name = artifact_weapon_type
							value = flag:artifact_weapon_type_spear
						}
					}
					20 = { # 10
						set_variable = {
							name = artifact_weapon_type
							value = flag:artifact_weapon_type_sword
						}
					}
					50 = { #They don't care and you can decide!
						trigger = {
							scope:allow_no_type_option = yes
						}
						modifier = {
							add = 30
							has_personality_submissive_trigger = yes
						}
						modifier = {
							add = 9890 # ~1% chance of being predetermined if comissioning from a local artisan.
							has_character_flag = local_artisan
						}
						ai_value_modifier = {
							ai_boldness = -0.25
							ai_energy = -0.25
						}
						# Don't set on creation so that the player has more input on what gets forged in inspiration start events, like fund_inspiration.0015
					}
				}
			}
		}
	}
}

create_artifact_weapon_effect = {
	# Get the character the artifact is being made for.
	# If scope:adventurer exists this will result in the history entry reading that the weapon was discovered instead of made.
	$OWNER$ = { save_scope_as = owner }
	$CREATOR$ = { save_scope_as = smith }
	save_temporary_scope_value_as = {
		name = weapon_type_is_set
		value = $SET_WEAPON_TYPE$
	}
	if = { #Any existing dummy character gets turned into the smith
		limit = {
			exists = scope:dummy_gender
			scope:smith = scope:dummy_gender
		}
		clear_saved_scope = smith
		clear_saved_scope = dummy_gender
	}

	hidden_effect_new_object = {
		if = {
			limit = {
				scope:weapon_type_is_set = flag:no
			}
			if = {
				limit = {
					exists = scope:smith
				}
				set_weapon_artifact_type_effect = {
					BASE_SCOPE = scope:smith
					NO_TYPE = no
				}
				scope:smith = {
					var:artifact_weapon_type = { save_scope_as = weapon_type }
					remove_variable = artifact_weapon_type
				}
			}
			else = {
				set_weapon_artifact_type_effect = {
					BASE_SCOPE = scope:owner
					NO_TYPE = no
				}
				scope:owner = {
					var:artifact_weapon_type = { save_scope_as = weapon_type }
					remove_variable = artifact_weapon_type
				}
			}
		}
		else = {
			scope:weapon_type_is_set = { save_scope_as = weapon_type }
		}
		# Get artifact quality and wealth.
		get_artifact_quality_effect = yes
		get_artifact_wealth_effect = yes

		# Get the type of weapon to forge. Defaults to sword if an invalid type is provided.
		if = {
			limit = { scope:weapon_type = flag:artifact_weapon_type_axe }
			if = {
				limit = { exists = scope:adventurer }
				create_artifact = {
					name = artifact_axe_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = axe
					type = axe
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = {
						location = scope:location
						actor = scope:adventurer
						recipient = root
						type = discovered
					}
				}
			}
			else_if = {
				limit = { exists = scope:smith }
				create_artifact = {
					name = artifact_axe_name
					creator = scope:smith
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = axe
					type = axe
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
				}
			}
			else_if = {
				limit = {
					scope:host ?= $OWNER$
					scope:activity ?= { has_activity_type = activity_tournament }
				}
				tournament_contest_weapon_prize_effect = { VISUALS = axe TYPE = axe }
			}
			else = {
				create_artifact = {
					name = artifact_axe_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = axe
					type = axe
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = { type = created_before_history }
				}
			}
			scope:newly_created_artifact = {
				get_axe_decoration_effect = yes
				get_artifact_feature_references_effect = yes
				set_artifact_description = artifact_axe_description
			}
		}
		else_if = {
			limit = { scope:weapon_type = flag:artifact_weapon_type_hammer }
			if = {
				limit = { exists = scope:adventurer }
				create_artifact = {
					name = artifact_hammer_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = hammer
					type = hammer
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = {
						location = scope:location
						actor = scope:adventurer
						recipient = root
						type = discovered
					}
				}
			}
			else_if = {
				limit = { exists = scope:smith }
				create_artifact = {
					name = artifact_hammer_name
					creator = scope:smith
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = hammer
					type = hammer
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
				}
			}
			else_if = {
				limit = {
					scope:host ?= $OWNER$
					scope:activity ?= { has_activity_type = activity_tournament }
				}
				tournament_contest_weapon_prize_effect = { VISUALS = hammer TYPE = hammer }
			}
			else = {
				create_artifact = {
					name = artifact_hammer_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = hammer
					type = hammer
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = { type = created_before_history }
				}
			}
			scope:newly_created_artifact = {
				get_hammer_decoration_effect = yes
				get_artifact_feature_references_effect = yes
				set_artifact_description = artifact_hammer_description
			}
		}
		else_if = {
			limit = { scope:weapon_type = flag:artifact_weapon_type_spear }
			if = {
				limit = { exists = scope:adventurer }
				create_artifact = {
					name = artifact_spear_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = spear
					type = spear
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = {
						location = scope:location
						actor = scope:adventurer
						recipient = root
						type = discovered
					}
				}
			}
			else_if = {
				limit = { exists = scope:smith }
				create_artifact = {
					name = artifact_spear_name
					creator = scope:smith
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = spear
					type = spear
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
				}
			}
			else_if = {
				limit = {
					scope:host ?= $OWNER$
					scope:activity ?= { has_activity_type = activity_tournament }
				}
				tournament_contest_weapon_prize_effect = { VISUALS = spear TYPE = spear }
			}
			else = {
				create_artifact = {
					name = artifact_spear_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = spear
					type = spear
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = { type = created_before_history }
				}
			}
			scope:newly_created_artifact = {
				get_spear_decoration_effect = yes
				get_artifact_feature_references_effect = yes
				set_artifact_description = artifact_spear_description
			}
		}
		else_if = {
			limit = { scope:weapon_type = flag:artifact_weapon_type_mace }
			if = {
				limit = { exists = scope:adventurer }
				create_artifact = {
					name = artifact_mace_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = mace
					type = mace
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = {
						location = scope:location
						actor = scope:adventurer
						recipient = root
						type = discovered
					}
				}
			}
			else_if = {
				limit = { exists = scope:smith }
				create_artifact = {
					name = artifact_mace_name
					creator = scope:smith
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = mace
					type = mace
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
				}
			}
			else_if = {
				limit = {
					scope:host ?= $OWNER$
					scope:activity ?= { has_activity_type = activity_tournament }
				}
				tournament_contest_weapon_prize_effect = { VISUALS = mace TYPE = mace }
			}
			else = {
				create_artifact = {
					name = artifact_mace_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = mace
					type = mace
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
				}
			}
			scope:newly_created_artifact = {
				get_mace_decoration_effect = yes
				get_artifact_feature_references_effect = yes
				set_artifact_description = artifact_mace_description
			}
		}
		else_if = {
			limit = { scope:weapon_type = flag:artifact_weapon_type_dagger }
			if = {
				limit = { exists = scope:adventurer }
				create_artifact = {
					name = artifact_dagger_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = dagger
					type = dagger
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = {
						location = scope:location
						actor = scope:adventurer
						recipient = root
						type = discovered
					}
				}
			}
			else_if = {
				limit = { exists = scope:smith }
				create_artifact = {
					name = artifact_dagger_name
					creator = scope:smith
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = dagger
					type = dagger
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
				}
			}
			else_if = {
				limit = {
					scope:host ?= $OWNER$
					scope:activity ?= { has_activity_type = activity_tournament }
				}
				tournament_contest_weapon_prize_effect = { VISUALS = dagger TYPE = dagger }
			}
			else = {
				create_artifact = {
					name = artifact_dagger_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = dagger
					type = dagger
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = { type = created_before_history }
				}
			}
			scope:newly_created_artifact = {
				get_dagger_decoration_effect = yes
				get_artifact_feature_references_effect = yes
				set_artifact_description = artifact_dagger_description
			}
		}
		else = {
			if = {
				limit = { exists = scope:adventurer }
				create_artifact = {
					name = artifact_sword_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = sword
					type = sword
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = {
						location = scope:location
						actor = scope:adventurer
						recipient = root
						type = discovered
					}
				}
			}
			else_if = {
				limit = {
					exists = scope:bowyer
				}
				create_artifact = {
					name = artifact_sword_name
					creator = scope:bowyer
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = sword
					type = sword
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
				}
			}
			else_if = {
				limit = {
					scope:host ?= $OWNER$
					scope:activity ?= { has_activity_type = activity_tournament }
					NOT = { $OWNER$ = { has_character_flag = event_4500_happening } }
				}
				random_list = {
					1 = {
						tournament_contest_weapon_prize_effect = { VISUALS = longsword TYPE = sword }
					}
					1 = {
						tournament_contest_weapon_prize_effect = { VISUALS = sword TYPE = sword }
					}
				}
			}
			else = {
				random_list = {
					3 = {
						trigger = {
							has_fp3_dlc_trigger = yes
							scope:smith ?= { artifact_should_use_gfx_type_trigger = { TYPE = iranian_building } }
						}
						create_artifact = {
							name = artifact_sassanian_replica_sword_name
							description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
							visuals = sassanian_sword
							type = sword
							modifier = artifact_prowess_1_modifier
							wealth = scope:wealth
							quality = scope:quality
							save_scope_as = newly_created_artifact
							history = { type = created_before_history }
						}
						scope:newly_created_artifact = { set_variable = replica_sassanian_sword }
					}
					1 = {
						trigger = { sword_could_be_longsword_trigger = yes }
						create_artifact = {
							name = artifact_longsword_name
							description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
							visuals = longsword
							type = sword
							modifier = artifact_prowess_1_modifier
							wealth = scope:wealth
							quality = scope:quality
							save_scope_as = newly_created_artifact
							history = { type = created_before_history }
						}
					}
					1 = {
						create_artifact = {
							name = artifact_sword_name
							description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
							visuals = sword
							type = sword
							modifier = artifact_prowess_1_modifier
							wealth = scope:wealth
							quality = scope:quality
							save_scope_as = newly_created_artifact
							history = { type = created_before_history }
						}
					}
				}
			}
			if = {
				limit = { scope:newly_created_artifact = { has_variable = replica_sassanian_sword } }
				if = {
					limit = {
						scope:newly_created_artifact = {
							OR = { 
								rarity = famed
								rarity = illustrious
							}
						}
					}
					scope:newly_created_artifact = { set_artifact_description = famed_replica_sassanian_sword_description }
				}
				else_if = {
					limit = { scope:newly_created_artifact = { rarity = masterwork } }
					scope:newly_created_artifact = { set_artifact_description = masterwork_replica_sassanian_sword_description }	
				}				
				else = {
					scope:newly_created_artifact = { set_artifact_description = common_replica_sassanian_sword_description }
				}
			}

			else = {
				scope:newly_created_artifact = {
					get_sword_decoration_effect = yes
					get_artifact_feature_references_effect = yes
					set_artifact_description = artifact_sword_description
				}
			}
		}

		scope:newly_created_artifact = {
			# Prowess from weapon rarity
			add_scaled_artifact_modifier_prowess_effect = yes

			if = {
				limit = {
					OR = {
						rarity = famed
						rarity = illustrious
					}
					OR = {
						has_artifact_feature_group = blade_decoration
						has_artifact_feature_group = hilt_decoration
						has_artifact_feature_group = shaft_decoration
						has_artifact_feature_group = head_decoration
						scope:weapon_type = flag:artifact_weapon_type_dagger
					}
				}
				if = {
					limit = { scope:weapon_type = flag:artifact_weapon_type_dagger }
					add_2_scaled_artifact_modifier_intrigue_effect = yes
				}
				else = {
					add_2_scaled_artifact_modifier_combat_effect = yes
				}
			}
			else_if = {
				limit = {
					OR = {
						rarity = common
						rarity = masterwork
					}
					OR = {
						has_artifact_feature_group = blade_decoration
						has_artifact_feature_group = hilt_decoration
						has_artifact_feature_group = shaft_decoration
						has_artifact_feature_group = head_decoration
						scope:weapon_type = flag:artifact_weapon_type_dagger
					}
				}
				if = {
					limit = { scope:weapon_type = flag:artifact_weapon_type_dagger }
					add_scaled_artifact_modifier_intrigue_effect = yes
				}
				else = {
					add_scaled_artifact_modifier_combat_effect = yes
				}
			}
			else_if = {
				limit = {
					OR = {
						rarity = famed
						rarity = illustrious
					}
					# No decorations
				}
				if = {
					limit = { scope:weapon_type = flag:artifact_weapon_type_dagger }
					add_scaled_artifact_modifier_intrigue_effect = yes
					add_artifact_modifier = artifact_prowess_no_decorations_high_tier_modifier
				}
				else = {
					add_scaled_artifact_modifier_combat_effect = yes
					add_artifact_modifier = artifact_prowess_no_decorations_high_tier_modifier
				}
			}
			else_if = {
				limit = {
					rarity = masterwork
					# No decorations
				}
				if = {
					limit = { scope:weapon_type = flag:artifact_weapon_type_dagger }
					add_scaled_artifact_modifier_intrigue_effect = yes
					add_artifact_modifier = artifact_prowess_no_decorations_modifier
				}
				else = {
					add_artifact_modifier = artifact_prowess_no_decorations_medium_tier_modifier
				}
			}
			else = {
				add_artifact_modifier = artifact_prowess_no_decorations_modifier
			}

			# Save the quality and wealth of this artifact in case we need to reference it later.
			set_variable = {
				name = quality
				value = scope:quality
			}
			set_variable = {
				name = wealth
				value = scope:wealth
			}
		}
	}
}

#################################################
#												#
# 		WEARABLE CREATION AND DECORATION 		#
#												#
#################################################

# Armor

# If the type of armor hasn't been decided yet we set it here
set_armor_artifact_type_effect = {
	save_temporary_scope_value_as = {
		name = allow_no_type_option
		value = $NO_TYPE$
	}
	# Historically many of these types of armor were used in some combination, but to give a clearer portrayal to the player we have to simplify it a bit
	hidden_effect = {
		$BASE_SCOPE$ = {
			#The type has been decided in events, when the character got inspired, or now. Let's save it! (might still leave it up to the sponsor if allow_no_type_option = yes!)
			if = {
				limit = {
					NOT = { exists = var:artifact_armor_type }
				}
				random_list = { #What do they want to forge?
					50 = { #Fairly common everywhere
						artifact_armor_type_mail_modifier = yes
						set_variable = {
							name = artifact_armor_type
							value = flag:armor_type_mail
						}
					}
					50 = { # 1 #Expensive
						artifact_armor_type_plate_modifier = yes
						set_variable = {
							name = artifact_armor_type
							value = flag:armor_type_plate
						}
						modifier = {
							factor = 0
							culture = {
								NOT = { has_innovation = innovation_plate_armor }
							}
						}
					}
					50 = { #Fairly common everywhere
						artifact_armor_type_scale_modifier = yes
						set_variable = {
							name = artifact_armor_type
							value = flag:armor_type_scale
						}
					}
					50 = { # 5 #Expensive
						artifact_armor_type_lamellar_modifier = yes
						set_variable = {
							name = artifact_armor_type
							value = flag:armor_type_lamellar
						}
					}
					50 = { # 5
						artifact_armor_type_laminar_modifier = yes
						set_variable = {
							name = artifact_armor_type
							value = flag:armor_type_laminar
						}
					}
					50 = { # 0
						artifact_armor_type_brigandine_modifier = yes
						set_variable = {
							name = artifact_armor_type
							value = flag:armor_type_brigandine
						}
					}
					50 = { #They don't care and you can decide!
						trigger = {
							scope:allow_no_type_option = yes
						}
						modifier = {
							add = 30
							has_personality_submissive_trigger = yes
						}
						modifier = {
							add = 9916 # ~1% chance of being predetermined if comissioning from a local artisan.
							has_character_flag = local_artisan
						}
						ai_value_modifier = {
							ai_boldness = -0.25
							ai_energy = -0.25
						}
					}
				}
			}
		}
	}
}

# Create the armor
# -OWNER is always needed
# -CREATOR needs a scope, if you want no smith specified you can use "random_dummy_gender_effect = yes" before the armor creation effect and then scope:dummy_gender for CREATOR
# -SET_ARMOR_TYPE has to be a flag, and has to be one of the armor types used in set_armor_artifact_type_effect and ArtifactArmorFullName custom loc key. Use "flag:no" for a random type.
# If scope:adventurer exists this will result in the history entry reading that the weapon was discovered instead of made.
#
# Example:
# create_artifact_armor_effect = {
#	 OWNER = root
#	 CREATOR = scope:dummy_gender
#	 SET_ARMOR_TYPE = flag:armor_type_lamellar
# }
# This will give you lamellar armor with no known smith.
create_artifact_armor_effect = {
	# Get the character the artifact is being made for.
	$OWNER$ = { save_scope_as = owner }
	$CREATOR$ = { save_scope_as = smith }
	save_temporary_scope_value_as = {
		name = armor_type_is_set
		value = $SET_ARMOR_TYPE$
	}
	if = {
		limit = {
			exists = scope:dummy_gender
			scope:smith = scope:dummy_gender
		}
		clear_saved_scope = smith
		clear_saved_scope = dummy_gender
	}

	hidden_effect_new_object = {
		if = {
			limit = {
				scope:armor_type_is_set = flag:no
			}
			if = {
				limit = {
					exists = scope:smith
				}
				set_armor_artifact_type_effect = {
					BASE_SCOPE = scope:smith
					NO_TYPE = no
				}
				scope:smith = {
					var:artifact_armor_type = { save_scope_as = armor_type }
					remove_variable = artifact_armor_type
				}
			}
			else = {
				set_armor_artifact_type_effect = {
					BASE_SCOPE = scope:owner
					NO_TYPE = no
				}
				scope:owner = {
					var:artifact_armor_type = { save_scope_as = armor_type }
					remove_variable = artifact_armor_type
				}
			}
		}
		else = {
			scope:armor_type_is_set = { save_scope_as = armor_type }
		}
		# Get artifact quality and wealth
		get_artifact_quality_effect = yes
		get_artifact_wealth_effect = yes

		if = {
			limit = { scope:armor_type = flag:armor_type_plate }
			if = {
				limit = {
					exists = scope:adventurer
				}
				create_artifact = {
					name = placeholder
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					type = armor_plate
					visuals = armor
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = {
						location = scope:location
						actor = scope:adventurer
						recipient = root
						type = discovered
					}
				}
			}
			else_if = {
				limit = { exists = scope:smith }
				create_artifact = {
					name = placeholder
					creator = scope:smith
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					type = armor_plate
					visuals = armor
					wealth = scope:wealth
					quality = scope:quality
					modifier = artifact_prowess_1_modifier
					save_scope_as = newly_created_artifact
				}
			}
			else_if = {
				limit = {
					exists = scope:host
					exists = scope:activity
				}
				tournament_contest_armor_prize_effect = { TYPE = plate }
			}
			else = {
				create_artifact = {
					name = placeholder
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					type = armor_plate
					visuals = armor
					wealth = scope:wealth
					quality = scope:quality
					modifier = artifact_prowess_1_modifier
					save_scope_as = newly_created_artifact
					history = { type = created_before_history }
				}
			}
		}
		else_if = {
			limit = { scope:armor_type = flag:armor_type_scale }
			if = {
				limit = { exists = scope:adventurer }
				create_artifact = {
					name = placeholder
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					type = armor_scale
					visuals = armor
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = {
						location = scope:location
						actor = scope:adventurer
						recipient = root
						type = discovered
					}
				}
			}
			else_if = {
				limit = { exists = scope:smith }
				create_artifact = {
					name = placeholder
					creator = scope:smith
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					type = armor_scale
					wealth = scope:wealth
					quality = scope:quality
					visuals = armor
					modifier = artifact_prowess_1_modifier
					save_scope_as = newly_created_artifact
				}
			}
			else_if = {
				limit = {
					exists = scope:host
					exists = scope:activity
				}
				tournament_contest_armor_prize_effect = { TYPE = scale }
			}
			else = {
				create_artifact = {
					name = placeholder
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					type = armor_scale
					wealth = scope:wealth
					quality = scope:quality
					visuals = armor
					modifier = artifact_prowess_1_modifier
					save_scope_as = newly_created_artifact
					history = { type = created_before_history }
				}
			}
		}
		else_if = {
			limit = { scope:armor_type = flag:armor_type_lamellar }
			if = {
				limit = { exists = scope:adventurer }
				create_artifact = {
					name = placeholder
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					type = armor_lamellar
					visuals = armor
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = {
						location = scope:location
						actor = scope:adventurer
						recipient = root
						type = discovered
					}
				}
			}
			else_if = {
				limit = { exists = scope:smith }
				create_artifact = {
					name = placeholder
					creator = scope:smith
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					type = armor_lamellar
					visuals = armor
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
				}
			}
			else_if = {
				limit = {
					exists = scope:host
					exists = scope:activity
				}
				tournament_contest_armor_prize_effect = { TYPE = lamellar }
			}
			else = {
				create_artifact = {
					name = placeholder
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					type = armor_lamellar
					visuals = armor
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = { type = created_before_history }
				}
			}
		}
		else_if = {
			limit = { scope:armor_type = flag:armor_type_laminar }
			if = {
				limit = { exists = scope:adventurer }
				create_artifact = {
					name = placeholder
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					type = armor_laminar
					visuals = armor
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = {
						location = scope:location
						actor = scope:adventurer
						recipient = root
						type = discovered
					}
				}
			}
			else_if = {
				limit = { exists = scope:smith }
				create_artifact = {
					name = placeholder
					creator = scope:smith
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					type = armor_laminar
					visuals = armor
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
				}
			}
			else_if = {
				limit = {
					exists = scope:host
					exists = scope:activity
				}
				tournament_contest_armor_prize_effect = { TYPE = laminar }
			}
			else = {
				create_artifact = {
					name = placeholder
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					type = armor_laminar
					visuals = armor
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = { type = created_before_history }
				}
			}
		}
		else_if = {
			limit = { scope:armor_type = flag:armor_type_brigandine }
			if = {
				limit = { exists = scope:adventurer }
				create_artifact = {
					name = placeholder
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					type = armor_brigandine
					visuals = armor
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = {
						location = scope:location
						actor = scope:adventurer
						recipient = root
						type = discovered
					}
				}
			}
			else_if = {
				limit = { exists = scope:smith }
				create_artifact = {
					name = placeholder
					creator = scope:smith
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					type = armor_brigandine
					visuals = armor
					wealth = scope:wealth
					quality = scope:quality
					modifier = artifact_prowess_1_modifier
					save_scope_as = newly_created_artifact
				}
			}
			else_if = {
				limit = {
					exists = scope:host
					exists = scope:activity
				}
				tournament_contest_armor_prize_effect = { TYPE = brigandine }
			}
			else = {
				create_artifact = {
					name = placeholder
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					type = armor_brigandine
					visuals = armor
					wealth = scope:wealth
					quality = scope:quality
					modifier = artifact_prowess_1_modifier
					save_scope_as = newly_created_artifact
					history = { type = created_before_history }
				}
			}
		}
		else = {
			# Defaults to mail as a common, ubiquitous type of armor.
			if = {
				limit = { exists = scope:adventurer }
				create_artifact = {
					name = placeholder
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					type = armor_mail
					visuals = armor
					wealth = scope:wealth
					quality = scope:quality
					modifier = artifact_prowess_1_modifier
					save_scope_as = newly_created_artifact
					history = {
						location = scope:location
						actor = scope:adventurer
						recipient = root
						type = discovered
					}
				}
			}
			else_if = {
				limit = { exists = scope:smith }
				create_artifact = {
					name = placeholder
					creator = scope:smith
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					type = armor_mail
					visuals = armor
					wealth = scope:wealth
					quality = scope:quality
					modifier = artifact_prowess_1_modifier
					save_scope_as = newly_created_artifact
				}
			}
			else_if = {
				limit = {
					exists = scope:host
					exists = scope:activity
				}
				tournament_contest_armor_prize_effect = { TYPE = mail }
			}
			else = {
				create_artifact = {
					name = placeholder
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					type = armor_mail
					visuals = armor
					wealth = scope:wealth
					quality = scope:quality
					modifier = artifact_prowess_1_modifier
					save_scope_as = newly_created_artifact
					history = { type = created_before_history }
				}
			}
		}
		scope:newly_created_artifact = {
			set_artifact_feature_group = armor_decoration
			set_artifact_feature_group = armor_property
			get_artifact_feature_references_effect = yes
			set_artifact_name = artifact_armor_name
			set_artifact_description = artifact_armor_description
		}


		# Let's add the modifiers!
		scope:newly_created_artifact = {
			# Rarity determines prowess bonus
			add_scaled_artifact_modifier_prowess_effect = yes
			# Rarity determines combat bonus
			add_scaled_artifact_modifier_combat_effect = yes

			if = { # Chain mail gets a higher prowess due to the lack of decoration
				limit = { artifact_type = armor_mail }
				add_artifact_modifier = artifact_prowess_no_decorations_modifier
			}
			else_if = { # Fashion gets an attraction boost
				limit = {
					OR = {
						artifact_type = armor_brigandine
						artifact_type = armor_plate
					}
				}
				add_artifact_modifier = artifact_attraction_opinion_1_modifier
			}
			else = { # For all other armor-types you get some prestige
				add_artifact_modifier = artifact_placeholder_modifier
			}

			if = { # Gold gives more prestige
				limit = {
					OR = {
						has_artifact_feature = armor_decoration_gold_plating
						has_artifact_feature = armor_material_gold
					}
				}
				add_artifact_modifier = artifact_monthly_prestige_2_modifier
			}

			set_variable = {
				name = quality
				value = scope:quality
			}
			set_variable = {
				name = wealth
				value = scope:wealth
			}
		}
	}
}

create_artifact_regalia_effect = {
	# Get the character the artifact is being made for.
	$OWNER$ = { save_scope_as = owner }
	$SMITH$ = { save_scope_as = goldsmith }
	# Get artifact quality and wealth
	get_artifact_quality_effect = yes
	get_artifact_wealth_effect = yes


	# Create the artifact
	if = {
		limit = {
			exists = scope:adventurer
		}
		create_artifact = {
			name = artifact_regalia_name
			description = artifact_regalia_description
			visuals = regalia
			type = regalia
			template = regalia_template
			modifier = artifact_placeholder_modifier
			wealth = scope:wealth
			quality = scope:quality
			save_scope_as = newly_created_artifact
			history = {
				location = scope:location
				actor = scope:adventurer
				recipient = root
				type = given
			}
		}
	}
	else = {
		create_artifact = {
			name = artifact_regalia_name
			description = artifact_regalia_description
			creator = scope:goldsmith
			visuals = regalia
			type = regalia
			template = regalia_template
			modifier = artifact_placeholder_modifier
			wealth = scope:wealth
			quality = scope:quality
			save_scope_as = newly_created_artifact
		}
	}

	hidden_effect_new_object = {
		scope:newly_created_artifact = {
			# Prestige modifier is scaled based on the Wealth of the artifact (opulence).
			add_scaled_artifact_modifier_minor_prestige_effect = yes

			# If we're using the cross-bearing orb (explicit religious symbol), trade some prestige for piety.
			if = {
				limit = {
					has_artifact_feature = regalia_accessory_orb
				}
				add_artifact_modifier = artifact_monthly_prestige_penalty_modifier
				if = {
					limit = { # Give a tiny bit more piety for high rarity artifacts.
						OR = {
							rarity = famed
							rarity = illustrious
						}
					}
					add_artifact_modifier = artifact_monthly_piety_5_modifier
				}
				else = {
					add_artifact_modifier = artifact_monthly_piety_2_modifier
				}
			}

			# Add a Majesty-related modifier based on the Quality of the artifact.
			if = {
				limit = { # Add a second Majesty-related modifier for high rarity artifacts.
					OR = {
						rarity = famed
						rarity = illustrious
					}
				}
				add_2_scaled_artifact_modifier_majesty_effect = yes
			}
			else = {
				add_scaled_artifact_modifier_majesty_effect = yes
			}

			add_scaled_artifact_modifier_attractiveness_effect = yes

			set_variable = {
				name = quality
				value = scope:quality
			}
			set_variable = {
				name = wealth
				value = scope:wealth
			}
		}
	}
}

create_artifact_icon_effect = {
	$OWNER$ = { save_scope_as = owner }
	$CREATOR$ = { save_scope_as = creator }

	hidden_effect_new_object = {
		# Get artifact quality, wealth, materials, and decorations
		get_artifact_quality_effect = yes
		get_artifact_wealth_effect = yes

		random_list = {
			50 = {
				trigger = { scope:owner = { has_royal_court = yes } }
				create_artifact = {
					name = artifact_icon_name
					creator = scope:creator
					description = placeholder # Will be updated in the post-creation effects
					visuals = icon_court_large
					type = wall_icon_court_large
					modifier = artifact_placeholder_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
				}
			}
			50 = {
				trigger = { scope:owner = { has_royal_court = yes } }
				create_artifact = {
					name = artifact_icon_name
					creator = scope:creator
					description = placeholder # Will be updated in the post-creation effects
					visuals = icon_court_small
					type = wall_icon_court_small
					modifier = artifact_placeholder_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
				}
			}
			50 = {
				trigger = { scope:owner = { has_royal_court = no } }
				create_artifact = {
					name = artifact_icon_name
					creator = scope:creator
					description = placeholder # Will be updated in the post-creation effects
					visuals = trinket_icon
					type = miscellaneous_when_not_court
					modifier = artifact_placeholder_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
				}
			}
		}

		scope:newly_created_artifact = {
			# Get decoration type and update description
			get_artifact_feature_references_effect = yes
			set_artifact_name = artifact_icon_name
			set_artifact_description = artifact_icon_description

			# Crowns with high rarity get more modifiers
			if = {
				limit = {
					rarity = illustrious
				}
				add_2_scaled_artifact_modifier_rulership_effect = yes
				add_scaled_artifact_modifier_devotion_effect = yes
				add_scaled_artifact_modifier_piety_effect = yes
			}
			else_if = {
				limit = {
					rarity = famed
				}
				add_2_scaled_artifact_modifier_rulership_effect = yes
				add_scaled_artifact_modifier_devotion_effect = yes
				add_scaled_artifact_modifier_piety_effect = yes
			}
			else_if = {
				limit= {
					rarity = masterwork
				}
				add_scaled_artifact_modifier_piety_effect = yes
				add_scaled_artifact_modifier_rulership_effect = yes
			}
			else_if = {
				limit= {
					rarity = common
				}
				add_scaled_artifact_modifier_piety_effect = yes
				add_scaled_artifact_modifier_rulership_effect = yes
			}

			set_variable = {
				name = quality
				value = scope:quality
			}
			set_variable = {
				name = wealth
				value = scope:wealth
			}
		}
	}
}

create_artifact_crown_effect = {
	# Get the character the artifact is being made for.
	$OWNER$ = { save_scope_as = owner }
	$SMITH$ = { save_scope_as = goldsmith }

	hidden_effect_new_object = {
		# Get artifact quality, wealth, materials, and decorations
		get_artifact_quality_effect = yes
		get_artifact_wealth_effect = yes

		# Create the artifact
		if = {
			limit = { exists = scope:adventurer }
			create_artifact = {
				name = artifact_crown_name
				description = placeholder # Will be updated in the post-creation effects
				template = crown_wearable_template
				visuals = crown
				type = helmet
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
				history = {
					location = ROOT.capital_province
					actor = scope:adventurer
					recipient = scope:owner
					type = given
				}
			}
		}
		else = {
			create_artifact = {
				name = artifact_crown_name
				creator = scope:goldsmith
				description = placeholder # Will be updated in the post-creation effects
				template = crown_wearable_template
				visuals = crown
				type = helmet
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
			}
		}

		scope:newly_created_artifact = {
			# Get gem type if necessary and update description
			get_artifact_feature_references_effect = yes
			set_artifact_description = artifact_crown_description

			# Crowns with high rarity get more modifiers
			if = {
				limit = {
					rarity = illustrious
				}
				add_2_scaled_artifact_modifier_rulership_effect = yes
				add_scaled_artifact_modifier_majesty_effect = yes
				add_scaled_artifact_modifier_minor_prestige_effect = yes
			}
			else_if = {
				limit = {
					rarity = famed
				}
				add_2_scaled_artifact_modifier_rulership_effect = yes
				add_scaled_artifact_modifier_majesty_effect = yes
				add_scaled_artifact_modifier_minor_prestige_effect = yes
			}
			else_if = {
				limit= {
					rarity = masterwork
				}
				add_scaled_artifact_modifier_minor_prestige_effect = yes
				add_scaled_artifact_modifier_rulership_effect = yes
			}
			else_if = {
				limit= {
					rarity = common
				}
				add_scaled_artifact_modifier_minor_prestige_effect = yes
				add_scaled_artifact_modifier_rulership_effect = yes
			}

			set_variable = {
				name = quality
				value = scope:quality
			}
			set_variable = {
				name = wealth
				value = scope:wealth
			}
		}
	}
}

create_artifact_brooch_effect = {
	# Get the character the artifact is being made for.
	$OWNER$ = { save_scope_as = owner }
	$SMITH$ = { save_scope_as = goldsmith }

	hidden_effect_new_object = {
		# Get artifact quality, wealth, materials, and decorations
		get_artifact_quality_effect = yes
		get_artifact_wealth_effect = yes
		if = { #Any existing dummy character gets turned into the goldsmith
			limit = {
				exists = scope:dummy_gender
				scope:goldsmith = scope:dummy_gender
			}
			clear_saved_scope = goldsmith
			clear_saved_scope = dummy_gender
		}
		# Create the artifact
		if = {
			limit = { exists = scope:adventurer }
			create_artifact = {
				name = artifact_brooch_name
				description = placeholder
				visuals = brooch
				type = brooch
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
				history = {
					location = scope:location
					actor = scope:adventurer
					recipient = root
					type = discovered
				}
			}
		}
		else_if = {
			limit = {
				scope:host ?= $OWNER$
				scope:activity ?= { has_activity_type = activity_tournament }
			}
			create_artifact = {
				name = artifact_brooch_name
				creator = scope:host
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = brooch
				type = brooch
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				history = {
					type = prize_created
					recipient = scope:host
				}
				save_scope_as = newly_created_artifact
			}
		}
		else_if = {
			limit = { 
				exists = scope:goldsmith
				exists = scope:owner 
				scope:goldsmith = scope:owner 
			}
			create_artifact = {
				name = artifact_brooch_name
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = brooch
				type = brooch
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				history = {
					type = created
					actor = scope:goldsmith
					recipient = scope:goldsmith
					location = scope:goldsmith.location
				}
				save_scope_as = newly_created_artifact
			}
		}
		else_if = {
			limit = { exists = scope:goldsmith }
			create_artifact = {
				name = artifact_brooch_name
				creator = scope:goldsmith
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = brooch
				type = brooch
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
			}
		}
		else = {
			create_artifact = {
				name = artifact_brooch_name
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = brooch
				type = brooch
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
				history = { type = created_before_history }
			}
		}

		scope:newly_created_artifact = {
			# Finish generating decorations and update description
			if = {
				limit = {
					OR = {
						has_artifact_feature = brooch_decoration_adornment
						has_artifact_feature = brooch_decoration_centerpiece_and_adornment
					}
				}
				set_artifact_feature_group = brooch_adornment
			}
			if = {
				limit = {
					OR = {
						has_artifact_feature = brooch_decoration_centerpiece
						has_artifact_feature = brooch_decoration_centerpiece_and_adornment
					}
				}
				set_artifact_feature_group = brooch_centerpiece
			}
			get_artifact_feature_references_effect = yes
			set_artifact_description = artifact_brooch_description

			# Add artifact modifiers
			add_scaled_artifact_modifier_minor_prestige_effect = yes
			add_scaled_artifact_modifier_attractiveness_effect = yes
			if = {
				limit = {
					OR = {
						rarity = famed
						rarity = illustrious
					}
				}
				add_scaled_artifact_modifier_rulership_effect = yes
			}

			set_variable = {
				name = quality
				value = scope:quality
			}
			set_variable = {
				name = wealth
				value = scope:wealth
			}
		}
	}
}

create_artifact_brooch_pedestal_effect = {
	# Get the character the artifact is being made for.
	$OWNER$ = { save_scope_as = owner }
	$SMITH$ = { save_scope_as = goldsmith }
	if = { #Any existing dummy character gets turned into the goldsmith
		limit = {
			exists = scope:dummy_gender
			scope:goldsmith = scope:dummy_gender
		}
		clear_saved_scope = goldsmith
		clear_saved_scope = dummy_gender
	}
	hidden_effect_new_object = {
		# Get artifact quality, wealth, materials, and decorations
		get_artifact_quality_effect = yes
		get_artifact_wealth_effect = yes

		# Create the artifact
		if = {
			limit = {
				scope:host ?= $OWNER$
				scope:activity ?= { has_activity_type = activity_tournament }
			}
			create_artifact = {
				name = artifact_brooch_name
				creator = scope:host
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = brooch_pedestal
				type = brooch_pedestal
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				history = {
					type = prize_created
					recipient = scope:host
				}
				save_scope_as = newly_created_artifact
			}
		}
		else_if = {
			limit = { exists = scope:goldsmith }
			create_artifact = {
				name = artifact_brooch_name
				creator = scope:goldsmith
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = brooch_pedestal
				type = brooch_pedestal
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
			}
		}
		else = {
			create_artifact = {
				name = artifact_brooch_name
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = brooch_pedestal
				type = brooch_pedestal
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
				history = { type = created_before_history }
			}
		}

		scope:newly_created_artifact = {
			# Finish generating decorations and update description
			if = {
				limit = {
					OR = {
						has_artifact_feature = brooch_decoration_adornment
						has_artifact_feature = brooch_decoration_centerpiece_and_adornment
					}
				}
				set_artifact_feature_group = brooch_adornment
			}
			if = {
				limit = {
					OR = {
						has_artifact_feature = brooch_decoration_centerpiece
						has_artifact_feature = brooch_decoration_centerpiece_and_adornment
					}
				}
				set_artifact_feature_group = brooch_centerpiece
			}
			get_artifact_feature_references_effect = yes
			set_artifact_description = artifact_brooch_description

			# Add artifact modifiers
			add_scaled_artifact_modifier_minor_prestige_effect = yes
			add_scaled_artifact_modifier_attractiveness_effect = yes
			if = {
				limit = {
					OR = {
						rarity = famed
						rarity = illustrious
					}
				}
				add_scaled_artifact_modifier_rulership_effect = yes
			}

			set_variable = {
				name = quality
				value = scope:quality
			}
			set_variable = {
				name = wealth
				value = scope:wealth
			}
		}
	}
}

#################################################
#												#
# 			OBJECTS AND TRINKETS 		 		#
#												#
#################################################

create_artifact_necklace_effect = {
	# Get the character the artifact is being made for.
	$OWNER$ = { save_scope_as = owner }
	$SMITH$ = { save_scope_as = goldsmith }
	if = { #Any existing dummy character gets turned into the goldsmith
		limit = {
			exists = scope:dummy_gender
			scope:goldsmith = scope:dummy_gender
		}
		clear_saved_scope = goldsmith
		clear_saved_scope = dummy_gender
	}
	hidden_effect_new_object = {
		# Get artifact quality and wealth
		get_artifact_quality_effect = yes
		get_artifact_wealth_effect = yes
		# Create the artifact
		if = {
			limit = { exists = scope:adventurer }
			create_artifact = {
				name = artifact_necklace_name
				description = placeholder #properly set later
				visuals = necklace
				type = necklace
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
				history = {
					location = scope:location
					actor = scope:adventurer
					recipient = root
					type = discovered
				}
			}
		}
		else_if = {
			limit = {
				scope:host ?= $OWNER$
				scope:activity ?= { has_activity_type = activity_tournament }
			}
			create_artifact = {
				name = artifact_brooch_name
				creator = scope:host
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = necklace
				type = necklace
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				history = {
					type = prize_created
					recipient = scope:host
				}
				save_scope_as = newly_created_artifact
			}
		}
		else_if = {
			limit = { 
				exists = scope:goldsmith
				exists = scope:owner 
				scope:goldsmith = scope:owner 
			}
			create_artifact = {
				name = artifact_necklace_name
				description = placeholder #properly set later
				visuals = necklace
				type = necklace
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				history = {
					type = created
					actor = scope:goldsmith
					recipient = scope:goldsmith
					location = scope:goldsmith.location
				}
				save_scope_as = newly_created_artifact
			}
		}
		else_if = {
			limit = { exists = scope:goldsmith }
			create_artifact = {
				name = artifact_necklace_name
				creator = scope:goldsmith
				description = placeholder #properly set later
				visuals = necklace
				type = necklace
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
			}
		}
		else = {
			create_artifact = {
				name = artifact_necklace_name
				description = placeholder #properly set later
				visuals = necklace
				type = necklace
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
				history = { type = created_before_history }
			}
		}
		scope:newly_created_artifact = {
			#Loc
			get_artifact_feature_references_effect = yes
			set_artifact_description = artifact_necklace_description
			remove_artifact_modifier = artifact_placeholder_modifier
			add_scaled_artifact_modifier_minor_prestige_effect = yes
			add_scaled_artifact_modifier_attractiveness_effect = yes
			if = {
				limit = {
					OR = {
						rarity = famed
						rarity = illustrious
					}
				}
				add_scaled_artifact_modifier_majesty_effect = yes
			}
			set_variable = {
				name = quality
				value = scope:quality
			}
			set_variable = {
				name = wealth
				value = scope:wealth
			}
		}
	}
}

create_artifact_necklace_pedestal_effect = {
	# Get the character the artifact is being made for.
	$OWNER$ = { save_scope_as = owner }
	$SMITH$ = { save_scope_as = goldsmith }
	if = { #Any existing dummy character gets turned into the goldsmith
		limit = {
			exists = scope:dummy_gender
			scope:goldsmith = scope:dummy_gender
		}
		clear_saved_scope = goldsmith
		clear_saved_scope = dummy_gender
	}
	hidden_effect_new_object = {
		# Get artifact quality and wealth
		get_artifact_quality_effect = yes
		get_artifact_wealth_effect = yes
		# Create the artifact
		if = {
			limit = { exists = scope:adventurer }
			create_artifact = {
				name = artifact_necklace_name
				creator = scope:goldsmith
				description = placeholder #properly set later
				visuals = necklace_pedestal
				type = necklace_pedestal
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
				history = {
					location = scope:location
					actor = scope:adventurer
					recipient = root
					type = given
				}
			}
		}
		else_if = {
			limit = {
				scope:host ?= $OWNER$
				scope:activity ?= { has_activity_type = activity_tournament }
			}
			create_artifact = {
				name = artifact_brooch_name
				creator = scope:host
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = brooch
				type = brooch
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				history = {
					type = prize_created
					recipient = scope:host
				}
				save_scope_as = newly_created_artifact
			}
		}
		else_if = {
			limit = { exists = scope:goldsmith }
			create_artifact = {
				name = artifact_necklace_name
				creator = scope:goldsmith
				description = placeholder #properly set later
				visuals = necklace_pedestal
				type = necklace_pedestal
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
			}
		}
		else = {
			create_artifact = {
				name = artifact_necklace_name
				description = placeholder #properly set later
				visuals = necklace_pedestal
				type = necklace_pedestal
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
				history = { type = created_before_history }
			}
		}
		scope:newly_created_artifact = {
			#Loc
			get_artifact_feature_references_effect = yes
			set_artifact_description = artifact_necklace_description
			remove_artifact_modifier = artifact_placeholder_modifier
			add_scaled_artifact_modifier_minor_prestige_effect = yes
			add_scaled_artifact_modifier_attractiveness_effect = yes
			if = {
				limit = {
					OR = {
						rarity = famed
						rarity = illustrious
					}
				}
				add_scaled_artifact_modifier_majesty_effect = yes
			}
			set_variable = {
				name = quality
				value = scope:quality
			}
			set_variable = {
				name = wealth
				value = scope:wealth
			}
		}
	}
}

# What flower have we ruthlessly picked and pressed?
get_pressed_flower_species_effect = {
	if = { #The hide hasn't been set yet, so we set it here (also works as backup)
		limit = {
			NOT = { exists = scope:flower_species }
		}
		random_list = {
			40 = {
				# they're everywhere
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_aster
				}
			}
			20 = {
				# they're everywhere
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_rose
				}
			}
			10 = {
				# they're everywhere, but rare
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_orchid
				}
			}
			10 = {
				# Europe or Asia
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_europe_south
							geographical_region = world_africa_north
							geographical_region = world_asia_minor
							geographical_region = world_middle_east
							geographical_region = world_steppe
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_poppy
				}
			}
			10 = {
				# Asia
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_asia_minor
							geographical_region = world_middle_east
							geographical_region = world_steppe_west
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_tulip
				}
			}
			10 = {
				# Mediterranean sea + arid Asia
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_europe_south
							geographical_region = world_africa_north
							geographical_region = world_asia_minor
							geographical_region = world_middle_east
							geographical_region = world_steppe
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_crocus
				}
			}
			10 = {
				# Europe, North Africa + parts of Asia
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_europe
							geographical_region = world_africa_north
							geographical_region = world_asia_minor
							geographical_region = world_middle_east
							geographical_region = world_steppe
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_narcissus
				}
			}
			10 = {
				# Africa + parts of Asia
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_india
							geographical_region = world_middle_east
							geographical_region = world_africa_west
							geographical_region = world_africa_east
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_hibiscus
				}
			}
			10 = {
				# parts of Africa + India
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_india
							geographical_region = world_africa_west
							geographical_region = world_africa_east
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_gardenia
				}
			}
			10 = {
				# parts of Asia
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_steppe_east
							geographical_region = world_steppe_tarim
							geographical_region = world_himalaya
							geographical_region = world_india
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_lotus
				}
			}
			10 = {
				# parts of Asia
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_steppe_east
							geographical_region = world_steppe_tarim
							geographical_region = world_himalaya
							geographical_region = world_india
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_chrysanthemum
				}
			}
			10 = {
				# parts of Asia
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_india
							geographical_region = world_middle_east
							geographical_region = world_asia_minor
							geographical_region = world_steppe_west
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_jasmine
				}
			}
			10 = {
				# Europe, Africa, and parts of Asia
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_europe
							geographical_region = world_middle_east
							geographical_region = world_asia_minor
							geographical_region = world_steppe
							geographical_region = world_africa
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_delphinium
				}
			}
			10 = {
				# Europe and Asia
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_europe
							geographical_region = world_middle_east
							geographical_region = world_asia_minor
							geographical_region = world_steppe_west
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_violet
				}
			}
			10 = {
				# Europe and Asia
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_europe
							geographical_region = world_middle_east
							geographical_region = world_asia_minor
							geographical_region = world_steppe_west
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_peony
				}
			}
			10 = {
				# Europe and Asia
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_europe
							geographical_region = world_middle_east
							geographical_region = world_asia_minor
							geographical_region = world_steppe
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_lavender
				}
			}
			10 = {
				# Europe and Asia
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_europe
							geographical_region = world_middle_east
							geographical_region = world_asia_minor
							geographical_region = world_steppe
							geographical_region = world_india
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_lily
				}
			}
			10 = {
				# Europe and parts of Asia
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_europe
							geographical_region = world_middle_east
							geographical_region = world_asia_minor
							geographical_region = world_steppe
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_geranium
				}
			}
			10 = {
				# Europe and parts of Asia
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_europe
							geographical_region = world_middle_east
							geographical_region = world_asia_minor
							geographical_region = world_steppe
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_iris
				}
			}
			10 = {
				# Europe and parts of Asia
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_europe
							geographical_region = world_middle_east
							geographical_region = world_asia_minor
							geographical_region = world_steppe_west
							geographical_region = world_africa_north
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_foxglove
				}
			}
			10 = {
				# Southern Europe and Northen Africa
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_europe_south
							geographical_region = world_africa_north
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_carnation
				}
			}
			10 = {
				# Southern Europe and Northen Africa
				modifier = {
					factor = 0
					$LOCATION$ = {
						NOR = {
							geographical_region = world_europe_south
							geographical_region = world_africa_north
						}
					}
				}
				save_scope_value_as = {
					name = flower_species
					value = flag:flower_type_snapdragon
				}
			}
		}
	}
}

create_artifact_pressed_flower_effect = {
	# Get the character the artifact is being made for.
	$OWNER$ = { save_scope_as = owner }
	scope:owner = { save_scope_as = creator }
	hidden_effect = {
		# Get artifact quality and wealth
		get_artifact_quality_effect = yes
		get_artifact_wealth_effect = yes

		#Get flower
		get_animal_hunt_location_effect = yes #not hunting, but need the location in a similar way
	}

	# Create the artifact
	scope:owner = {
		if = {
			limit = {
				exists = scope:flower_picker
			}
			hidden_effect = {
				get_pressed_flower_species_effect = { LOCATION = scope:flower_picker.location }
			}
			# Create the artifact
			create_artifact = {
				name = artifact_pressed_flower_name
				description = placeholder #properly set later
				creator = scope:flower_picker
				visuals = flowers
				type = miscellaneous
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
			}
		}
		else = {
			hidden_effect = {
				get_pressed_flower_species_effect = { LOCATION = scope:owner.location }
			}
			# Create the artifact
			create_artifact = {
				name = artifact_pressed_flower_name
				description = placeholder #properly set later
				creator = scope:owner
				visuals = flowers
				type = miscellaneous
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
			}
		}
	}




	hidden_effect_new_object = {
		scope:newly_created_artifact = {
			#Loc
			get_artifact_feature_references_effect = yes
			set_artifact_description = artifact_pressed_flower_description
			remove_artifact_modifier = artifact_placeholder_modifier
			add_scaled_artifact_modifier_minor_prestige_effect = yes

			# If the average wealth/quality of the artifact is above 75, add 2nd tier fertility bonus

			if = {
				limit = {
					rarity = illustrious
				}
				add_artifact_modifier = artifact_fertility_gain_4_modifier
			}
			else_if = {
				limit = {
					rarity = famed
				}
				add_artifact_modifier = artifact_fertility_gain_3_modifier
			}
			else_if = {
				limit = {
					rarity = masterwork
				}
				add_artifact_modifier = artifact_fertility_gain_2_modifier
			}
			else_if = {
				limit = {
					rarity = common
				}
				add_artifact_modifier = artifact_fertility_gain_1_modifier
			}

			set_variable = {
				name = quality
				value = scope:quality
			}
			set_variable = {
				name = wealth
				value = scope:wealth
			}
			set_variable = {
				name = flower_species
				value = scope:flower_species
			}
		}
	}
}

# Currently just armillary spheres, but can be added to in future.
roll_scientific_apparatus_effect = {
	random_list = {
		100 = {
			trigger = {
				eligible_for_scientific_apparatus_armillary_sphere_trigger = { CHARACTER = $CHARACTER$ }
			}
			save_scope_value_as = {
				name = artefact_scientific_apparatus_type
				value = flag:artisan_type_scientific_apparatus
			}
		}
	}
}

#### HOW TO generate_trinket_effect ####
#Use this template to make the generate_trinket_effect work
# generate_trinket_effect = {
# 	TRINKET_RECEIVER = scope:your_receiving_character
# 	TRINKET_GIVER = scope:your_giving_character
#	GRAB_ALL_TRINKETS = yes/no
#	HISTORY_TYPE = given_unknown/given/discovered_for/stolen_unknown/stolen/created_unknown/created/inherited_unknown/inherited/reforged/conquest/taken_in_siege
# }
#====================================
#TRINKET_RECEIVER/TRINKET_GIVER - if you don't have a giver and/or receiver, set the same character as both
#GRAB_ALL_TRINKETS - if you are not discerned with what trinkets you generate, put this as a "yes". Otherwise put it as a "no" and set your own flags.
#If you _are_ discerning and you want to choose which trinkets you want to be able to generate:
#	> Set an add_character_flag = { flag = used_in_stewardship_general.2001 } on your TRINKET_RECEIVER-character
#	> Refer to this flag in the trigger of the trinket below
#	> Remember to remove_character_flag = used_in_stewardship_general.2001 in your after = { ... }
#HISTORY_TYPE - pick one that fits the interaction in which you get the trinket
#====================================
generate_trinket_effect = {
	$TRINKET_RECEIVER$ = { save_scope_as = trinket_receiver }
	$TRINKET_GIVER$ = { save_scope_as = trinket_giver }
	scope:trinket_receiver = {
		set_variable = {
			name = grab_all_trinkets
			value = flag:$GRAB_ALL_TRINKETS$
		}
	}
	random_list = {
		#BAD
		##Bad 01
		###Gilded Rat's Tail
		80 = {
			#TRIGGERS
			trigger = {
				scope:trinket_receiver = {
					OR = {
						##If we are flagged to grab all trinkets
						var:grab_all_trinkets ?= flag:yes
						##stewardship_general.2001
						###Let's not get trash if we outwitted the merchant
						AND = {
							has_character_flag = used_in_stewardship_general.2001
							NOT = { has_character_flag = free_outcome_stewardship_general.2001 }
						}
						##^^Add more/other trigger flags above^^##
					}
				}
			}
			#MODIFIERS
			##stewardship_general.2001
			###We didn't choose the CHEAP option
			modifier = {
				scope:trinket_receiver = {
					OR = {
						has_character_flag = expensive_option_stewardship_general.2001
						has_character_flag = helpful_option_stewardship_general.2001
					}
				}
				add = -25
			}
			###We have extremely high stewardship skill
			modifier = {
				scope:trinket_receiver = { has_character_flag = has_extremely_high_stewardship_skill_stewardship_general.2001 }
				add = -25
			}
			##^^Add more/other modifier flags above^^##
			#DO NOT edit this part##
			create_artifact = {
				name = gilded_rats_tail
				description = gilded_rats_tail.desc
				type = miscellaneous
				visuals = ring
				modifier = artifact_monthly_prestige_penalty_modifier
				modifier = artifact_child_opinion_1_modifier
				save_scope_as = new_trinket
				wealth = 5
				quality = 5
				max_durability = 10
				generate_history = no
			}
			scope:new_trinket = {
				flag_as_trash_artifact = yes
				#The AI probably shouldn't want this bad trinket
				flag_as_unwanted_artifact = yes
			}
		}
		##Bad 02
		###Quail's Eggshell 'Gem'
		80 = {
			#TRIGGERS
			trigger = {
				scope:trinket_receiver = {
					OR = {
						##If we are flagged to grab all trinkets
						var:grab_all_trinkets ?= flag:yes
						##stewardship_general.2001
						###Let's not get trash if we outwitted the merchant
						AND = {
							has_character_flag = used_in_stewardship_general.2001
							NOT = { has_character_flag = free_outcome_stewardship_general.2001 }
						}
						has_character_flag = used_in_mpo_events_ariana_0070
						##^^Add more/other trigger flags above^^##
					}
				}
			}
			#MODIFIERS
			##stewardship_general.2001
			###We didn't choose the CHEAP option
			modifier = {
				scope:trinket_receiver = {
					OR = {
						has_character_flag = expensive_option_stewardship_general.2001
						has_character_flag = helpful_option_stewardship_general.2001
					}
				}
				add = -25
			}
			###We have extremely high stewardship skill
			modifier = {
				scope:trinket_receiver = { has_character_flag = has_extremely_high_stewardship_skill_stewardship_general.2001 }
				add = -25
			}
			##^^Add more/other modifier flags above^^##
			#DO NOT edit this part##
			create_artifact = {
				name = quail_eggshell_gem
				description = quail_eggshell_gem.desc
				type = miscellaneous
				visuals = diamond
				modifier = artifact_monthly_prestige_penalty_modifier
				modifier = artifact_fertility_gain_1_modifier
				save_scope_as = new_trinket
				wealth = 5
				quality = 5
				max_durability = 10
				generate_history = no
			}
			scope:new_trinket = {
				flag_as_trash_artifact = yes
				#The AI probably shouldn't want this bad trinket
				flag_as_unwanted_artifact = yes
			}
		}
		##Bad 03
		###Sanctified 'Stained' Glass Shard
		80 = {
			#TRIGGERS
			trigger = {
				scope:trinket_receiver = {
					OR = {
						##If we are flagged to grab all trinkets
						var:grab_all_trinkets ?= flag:yes
						##stewardship_general.2001
						###Let's not get trash if we outwitted the merchant
						AND = {
							has_character_flag = used_in_stewardship_general.2001
							NOT = { has_character_flag = free_outcome_stewardship_general.2001 }
						}
						##^^Add more/other trigger flags above^^##
					}
				}
			}
			#MODIFIERS
			##stewardship_general.2001
			###We didn't choose the CHEAP option
			modifier = {
				scope:trinket_receiver = {
					OR = {
						has_character_flag = expensive_option_stewardship_general.2001
						has_character_flag = helpful_option_stewardship_general.2001
					}
				}
				add = -25
			}
			###We have extremely high stewardship skill
			modifier = {
				scope:trinket_receiver = { has_character_flag = has_extremely_high_stewardship_skill_stewardship_general.2001 }
				add = -25
			}
			##^^Add more/other modifier flags above^^##
			#DO NOT edit this part##
			create_artifact = {
				name = stained_glass_shard
				description = stained_glass_shard.desc
				type = miscellaneous
				visuals = pocket_pouch
				modifier = desecrated_artifact_modifier
				modifier = artifact_dread_gain_mult_1_modifier
				save_scope_as = new_trinket
				wealth = 5
				quality = 5
				max_durability = 10
				generate_history = no
			}
			scope:new_trinket = {
				flag_as_trash_artifact = yes
				#The AI probably shouldn't want this bad trinket
				flag_as_unwanted_artifact = yes
			}
		}
		##Bad 04
		###Xylospongium
		80 = {
			#TRIGGERS
			trigger = {
				scope:trinket_receiver = {
					OR = {
						##If we are flagged to grab all trinkets
						var:grab_all_trinkets ?= flag:yes
						##stewardship_general.2001
						###Let's not get trash if we outwitted the merchant
						AND = {
							has_character_flag = used_in_stewardship_general.2001
							NOT = { has_character_flag = free_outcome_stewardship_general.2001 }
						}
						##^^Add more/other trigger flags above^^##
					}
				}
			}
			#MODIFIERS
			##stewardship_general.2001
			###We didn't choose the CHEAP option
			modifier = {
				scope:trinket_receiver = {
					OR = {
						has_character_flag = expensive_option_stewardship_general.2001
						has_character_flag = helpful_option_stewardship_general.2001
					}
				}
				add = -25
			}
			###We have extremely high stewardship skill
			modifier = {
				scope:trinket_receiver = { has_character_flag = has_extremely_high_stewardship_skill_stewardship_general.2001 }
				add = -25
			}
			##^^Add more/other modifier flags above^^##
			#DO NOT edit this part##
			create_artifact = {
				name = xylospongium
				description = xylospongium.desc
				type = miscellaneous
				visuals = pocket_basic_case
				modifier = artifact_health_penalty_1_modifier
				modifier = artifact_child_opinion_2_modifier
				save_scope_as = new_trinket
				wealth = 5
				quality = 5
				max_durability = 10
				generate_history = no
			}
			scope:new_trinket = {
				flag_as_trash_artifact = yes
				#The AI probably shouldn't want this bad trinket
				flag_as_unwanted_artifact = yes
			}
		}
		#COMMON
		##Common 01
		###St David's Morsel
		45 = {
			#TRIGGERS
			trigger = {
				scope:trinket_receiver = {
					OR = {
						##If we are flagged to grab all trinkets
						var:grab_all_trinkets ?= flag:yes
						##stewardship_general.2001
						has_character_flag = used_in_stewardship_general.2001
						##bp1_yearly.1021
						has_character_flag = 1021_token

						##^^Add more/other trigger flags above^^##
					}
				}
			}
			#MODIFIERS
			##stewardship_general.2001
			###More likely if we have our chaplain to help and chose the helpful option
			modifier = {
				scope:trinket_receiver = {
					has_character_flag = helpful_option_stewardship_general.2001
					has_character_flag = has_helpful_chaplain_stewardship_general.2001
				}
				add = 20
			}
			###Less likely if we already have a morsel
			modifier = {
				scope:trinket_receiver = {
					any_character_artifact = { has_variable = st_davids_morsel_trinket }
				}
				add = -40
			}
			##^^Add more/other trigger flags above^^##
			#DO NOT edit this part##
			create_artifact = {
				name = st_davids_morsel
				description = st_davids_morsel.desc
				type = miscellaneous
				visuals = pocket_fancy_case
				modifier = artifact_clergy_opinion_1_modifier
				modifier = artifact_zealot_vassal_opinion_2_modifier
				save_scope_as = new_trinket
				wealth = 15
				quality = 15
				max_durability = 30
				generate_history = no
			}
			scope:new_trinket = {
				set_variable = st_davids_morsel_trinket
				flag_as_trash_artifact = yes
			}
		}
		##Common 02
		###Platypus Figurine
		35 = {
			#TRIGGERS
			trigger = {
				scope:trinket_receiver = {
					##If we don't already have a platypus figurine in our inventory
					NOT = {
						any_character_artifact = { has_variable = platypus_trinket }
					}
					OR = {
						##If we are flagged to grab all trinkets
						var:grab_all_trinkets ?= flag:yes
						##stewardship_general.2001
						has_character_flag = used_in_stewardship_general.2001

						##^^Add more/other trigger flags above^^##
					}
				}
			}
			#MODIFIERS
			##^^Add more/other modifier flags above^^##
			#DO NOT edit this part##
			create_artifact = {
				name = platypus_figurine
				description = platypus_figurine.desc
				type = miscellaneous
				visuals = pocket_figurine
				modifier = artifact_stress_gain_2_modifier
				modifier = artifact_scheme_resistance_add_2_modifier
				save_scope_as = new_trinket
				wealth = 25
				quality = 25
				max_durability = 30
				history = {
					type = created_before_history
				}
			}
			scope:new_trinket = {
				set_variable = platypus_trinket
			}
		}
		##Common 03
		###Terracotta Toy Fowl
		55 = {
			#TRIGGERS
			trigger = {
				scope:trinket_receiver = {
					OR = {
						##If we are flagged to grab all trinkets
						var:grab_all_trinkets ?= flag:yes
						##stewardship_general.2001
						has_character_flag = used_in_stewardship_general.2001
						##bp1_yearly.1021
						has_character_flag = 1021_token

						##Add more/other trigger flags below
					}
				}
			}
			#MODIFIERS
			##stewardship_general.2001
			###Less likely if we have our steward to help and chose the helpful option
			modifier = {
				scope:trinket_receiver = {
					has_character_flag = helpful_option_stewardship_general.2001
					has_character_flag = has_helpful_steward_stewardship_general.2001
				}
				add = -25
			}
			###Less likely if we already have a Terracotta Toy Fowl
			modifier = {
				scope:trinket_receiver = {
					any_character_artifact = { has_variable = terracotta_toy_fowl_trinket }
				}
				add = -50
			}
			##^^Add more/other modifier flags above^^##
			#DO NOT edit this part##
			create_artifact = {
				name = terracotta_toy_fowl
				description = terracotta_toy_fowl.desc
				type = miscellaneous
				visuals = pocket_figurine
				modifier = artifact_monthly_prestige_1_modifier
				modifier = artifact_learning_1_modifier
				save_scope_as = new_trinket
				wealth = 15
				quality = 15
				max_durability = 30
				generate_history = no
			}
			scope:new_trinket = {
				set_variable = terracotta_toy_fowl_trinket
				flag_as_trash_artifact = yes
			}
		}
		##Common 04
		###Potsherd
		65 = {
			#TRIGGERS
			trigger = {
				scope:trinket_receiver = {
					OR = {
						##If we are flagged to grab all trinkets
						var:grab_all_trinkets ?= flag:yes
						##stewardship_general.2001
						has_character_flag = used_in_stewardship_general.2001
						##bp1_yearly.1021
						has_character_flag = 1021_token

						##Add more/other trigger flags below
					}
				}
			}
			#MODIFIERS
			##stewardship_general.2001
			###More likely if we have our chaplain to help and chose the helpful option
			modifier = {
				scope:trinket_receiver = {
					has_character_flag = helpful_option_stewardship_general.2001
					has_character_flag = has_helpful_chaplain_stewardship_general.2001
				}
				add = 20
			}
			###Less likely if we already have a Potsherd
			modifier = {
				scope:trinket_receiver = {
					any_character_artifact = { has_variable = potsherd_trinket }
				}
				add = -60
			}
			##^^Add more/other modifier flags above^^##
			#DO NOT edit this part##
			faith = {
				random_holy_site = { save_scope_as = trinket_holy_site }
			}
			create_artifact = {
				name = stewardship_general.2001.artifact.potsherd_holy
				description = stewardship_general.2001.artifact.potsherd_holy.desc
				type = miscellaneous
				visuals = rock
				modifier = artifact_clergy_opinion_1_modifier
				modifier = artifact_zealot_vassal_opinion_2_modifier
				save_scope_as = new_trinket
				wealth = 15
				quality = 15
				max_durability = 30
				generate_history = no
			}
			scope:new_trinket = {
				set_variable = potsherd_trinket
				flag_as_trash_artifact = yes
			}
		}
		##Common 05
		###Small Bell Beaker
		45 = {
			#TRIGGERS
			trigger = {
				scope:trinket_receiver = {
					OR = {
						##If we are flagged to grab all trinkets
						var:grab_all_trinkets ?= flag:yes
						##stewardship_general.2001
						has_character_flag = used_in_stewardship_general.2001
						##bp1_yearly.1021
						has_character_flag = 1021_token
						has_character_flag = used_in_mpo_events_ariana_0070
						##^^Add more/other trigger flags above^^##
					}
				}
			}
			#MODIFIERS
			##stewardship_general.2001
			###Less likely if we have extremely high stewardship or took the helpful councillor option
			modifier = {
				scope:trinket_receiver = {
					OR = {
						has_character_flag = helpful_option_stewardship_general.2001
						has_character_flag = has_extremely_high_stewardship_skill_stewardship_general.2001
					}
				}
				add = -25
			}
			###Less likely if we already have a Small Bell Beaker
			modifier = {
				scope:trinket_receiver = {
					any_character_artifact = { has_variable = small_bell_beaker_trinket }
				}
				add = -40
			}
			##^^Add more/other modifier flags above^^##
			#DO NOT edit this part##
			create_artifact = {
				name = small_bell_beaker
				description = small_bell_beaker.desc
				type = miscellaneous
				visuals = pocket_goblet
				modifier = artifact_monthly_prestige_1_modifier
				modifier = artifact_learning_1_modifier
				save_scope_as = new_trinket
				wealth = 15
				quality = 15
				max_durability = 30
				generate_history = no
			}
			scope:new_trinket = {
				set_variable = small_bell_beaker_trinket
				flag_as_trash_artifact = yes
			}
		}
		##Common 06
		###Serpentine Budai
		45 = {
			#TRIGGERS
			trigger = {
				scope:trinket_receiver = {
					OR = {
						##If we are flagged to grab all trinkets
						var:grab_all_trinkets ?= flag:yes
						##stewardship_general.2001
						has_character_flag = used_in_stewardship_general.2001
						##bp1_yearly.1021
						has_character_flag = 1021_token

						##^^Add more/other trigger flags above^^##
					}
				}
			}
			#MODIFIERS
			##stewardship_general.2001
			###Less likely if we have extremely high stewardship or took the helpful councillor option
			modifier = {
				scope:trinket_receiver = {
					OR = {
						has_character_flag = helpful_option_stewardship_general.2001
						has_character_flag = has_extremely_high_stewardship_skill_stewardship_general.2001
					}
				}
				add = -25
			}
			###Less likely if we already have a Serpentine Budai
			modifier = {
				scope:trinket_receiver = {
					any_character_artifact = { has_variable = serpentine_budai_trinket }
				}
				add = -40
			}
			##^^Add more/other modifier flags above^^##
			#DO NOT edit this part##
			create_artifact = {
				name = serpentine_budai
				description = serpentine_budai.desc
				type = miscellaneous
				visuals = pocket_figurine
				modifier = artifact_stress_gain_1_modifier
				modifier = artifact_different_faith_opinion_4_modifier
				save_scope_as = new_trinket
				wealth = 15
				quality = 15
				max_durability = 30
				generate_history = no
			}
			scope:new_trinket = {
				set_variable = serpentine_budai_trinket
				flag_as_trash_artifact = yes
			}
		}
		#UNCOMMON
		##Uncommon 01
		###<HornedMythicalCreature>'s Horn
		40 = {
			#TRIGGERS
			trigger = {
				scope:trinket_receiver = {
					OR = {
						##If we are flagged to grab all trinkets
						var:grab_all_trinkets ?= flag:yes
						##stewardship_general.2001
						has_character_flag = used_in_stewardship_general.2001
						##feast_default.1016
						has_character_flag = used_in_feast_default.1016
						##bp1_yearly.1021
						has_character_flag = 1021_token

						##^^Add more/other trigger flags above^^##
					}
				}
			}
			#MODIFIERS
			##stewardship_general.2001
			###More likely if we have our steward to help and chose the helpful option
			modifier = {
				scope:trinket_receiver = {
					has_character_flag = helpful_option_stewardship_general.2001
					has_character_flag = has_helpful_steward_stewardship_general.2001
				}
				add = 30
			}
			###Less likely if we already have a Mythical Horn
			modifier = {
				scope:trinket_receiver = {
					any_character_artifact = { has_variable = mythical_horn_trinket }
				}
				add = -35
			}
			##^^Add more/other modifier flags above^^##
			#DO NOT edit this part##
			set_up_horned_mythical_creature_effect = yes
			create_artifact = {
				name = mythical_creature_horn
				description = mythical_creature_horn.desc
				type = miscellaneous
				visuals = pocket_tusk
				modifier = artifact_fertility_gain_2_modifier
				modifier = artifact_spouse_opinion_add_2_modifier
				save_scope_as = new_trinket
				wealth = 45
				quality = 45
				max_durability = 60
				generate_history = no
			}
			scope:new_trinket = {
				set_variable = mythical_horn_trinket
			}
		}
		##Uncommon 02
		###<Adjective> <RegionalMythicalCreature> Figurine
		40 = {
			#TRIGGERS
			trigger = {
				scope:trinket_receiver = {
					OR = {
						##If we are flagged to grab all trinkets
						var:grab_all_trinkets ?= flag:yes
						##stewardship_general.2001
						has_character_flag = used_in_stewardship_general.2001
						##feast_default.1016
						has_character_flag = used_in_feast_default.1016
						##bp1_yearly.1021
						has_character_flag = 1021_token

						##^^Add more/other trigger flags above^^##
					}
				}
			}
			#MODIFIERS
			###Less likely if we already have a Mythical Figurine
			modifier = {
				scope:trinket_receiver = {
					any_character_artifact = { has_variable = mythical_creature_figurine_trinket }
				}
				add = -35
			}
			##^^Add more/other modifier flags above^^##
			#DO NOT edit this part##
			set_up_trinket_adjective_effect = yes
			set_up_regional_mythical_creature_effect = yes
			create_artifact = {
				name = mythical_creature_figurine
				description = mythical_creature_figurine.desc
				type = miscellaneous
				visuals = pocket_figurine
				modifier = artifact_monthly_learning_lifestyle_xp_1_modifier
				modifier = artifact_learning_1_modifier
				modifier = artifact_health_gain_1_modifier
				save_scope_as = new_trinket
				wealth = 45
				quality = 45
				max_durability = 60
				generate_history = no
			}
			scope:new_trinket = {
				set_variable = mythical_creature_figurine_trinket
			}
		}
		##Uncommon 03
		###St David's Taper
		30 = {
			#TRIGGERS
			trigger = {
				scope:trinket_receiver = {
					##If we don't already have a St David's Taper in our inventory
					NOT = {
						any_character_artifact = { has_variable = st_davids_taper_trinket }
					}
					OR = {
						##If we are flagged to grab all trinkets
						var:grab_all_trinkets ?= flag:yes
						##stewardship_general.2001
						AND = {
							###Only if we have our chaplain to help and chose the helpful option
							has_character_flag = has_helpful_chaplain_stewardship_general.2001
							has_character_flag = helpful_option_stewardship_general.2001
						}
						##feast_default.1016
						has_character_flag = used_in_feast_default.1016

						##^^Add more/other trigger flags above^^##
					}
				}
			}
			#MODIFIERS
			##^^Add more/other modifier flags above^^##
			#DO NOT edit this part##
			create_artifact = {
				name = st_davids_taper
				description = st_davids_taper.desc
				type = miscellaneous
				visuals = pocket_basic_case
				modifier = artifact_monthly_piety_1_modifier
				modifier = artifact_health_gain_1_modifier
				modifier = artifact_zealot_vassal_opinion_2_modifier
				save_scope_as = new_trinket
				wealth = 45
				quality = 45
				max_durability = 60
				generate_history = no
			}
			scope:new_trinket = {
				set_variable = st_davids_taper_trinket
			}
		}
		##Uncommon 04
		###Marble Stick of J'Ira
		30 = {
			#TRIGGERS
			trigger = {
				scope:trinket_receiver = {
					##If we don't already have a Jira poking stick in our inventory
					NOT = {
						any_character_artifact = { has_variable = jira_stick_trinket }
					}
					OR = {
						##If we are flagged to grab all trinkets
						var:grab_all_trinkets ?= flag:yes
						##stewardship_general.2001
						has_character_flag = used_in_stewardship_general.2001
						##feast_default.1016
						has_character_flag = used_in_feast_default.1016
						##bp1_yearly.1021
						has_character_flag = 1021_token

						##^^Add more/other trigger flags above^^##
					}
				}
			}
			#MODIFIERS
			modifier = {
				scope:trinket_receiver = { has_character_flag = less_than_decent_learning_stewardship_general.2001 }
				add = 30
			}
			##^^Add more/other modifier flags above^^##
			#DO NOT edit this part##
			create_artifact = {
				name = jira_stick
				description = jira_stick.desc
				type = miscellaneous
				visuals = regalia
				template = regalia_template
				modifier = artifact_monthly_learning_lifestyle_xp_1_modifier
				modifier = artifact_learning_1_modifier
				modifier = artifact_prowess_2_modifier
				save_scope_as = new_trinket
				wealth = 45
				quality = 45
				max_durability = 60
				generate_history = no
			}
			scope:new_trinket = {
				set_variable = jira_stick_trinket
			}
		}
		##Uncommon 05
		###Lucky <ROOT.Culture> Coin
		40 = {
			#TRIGGERS
			trigger = {
				scope:trinket_receiver = {
					OR = {
						##If we are flagged to grab all trinkets
						var:grab_all_trinkets ?= flag:yes
						##stewardship_general.2001
						has_character_flag = used_in_stewardship_general.2001
						##feast_default.1016
						has_character_flag = used_in_feast_default.1016
						##bp1_yearly.1021
						has_character_flag = 1021_token
						has_character_flag = used_in_mpo_events_ariana_0070
						##^^Add more/other trigger flags above^^##
					}
				}
			}
			#MODIFIERS
			##stewardship_general.2001
			###More likely if we have extremely high stewardship or took the expensive option
			modifier = {
				scope:trinket_receiver = {
					OR = {
						has_character_flag = expensive_option_stewardship_general.2001
						has_character_flag = has_extremely_high_stewardship_skill_stewardship_general.2001
					}
				}
				add = 25
			}
			###More likely if we have our steward to help and chose the helpful option
			modifier = {
				scope:trinket_receiver = {
					has_character_flag = helpful_option_stewardship_general.2001
					has_character_flag = has_helpful_steward_stewardship_general.2001
				}
				add = 30
			}
			###Less likely if we already have a lucky coin
			modifier = {
				scope:trinket_receiver = {
					any_character_artifact = { has_variable = lucky_coin_trinket }
				}
				add = -35
			}
			##^^Add more/other modifier flags above^^##
			#DO NOT edit this part##
			create_artifact = {
				name = lucky_coin
				description = lucky_coin.desc
				type = miscellaneous
				visuals = medallion
				modifier = artifact_monthly_stewardship_lifestyle_xp_1_modifier
				modifier = artifact_domain_tax_mult_2_modifier
				modifier = artifact_stewardship_per_stress_level_1_modifier
				save_scope_as = new_trinket
				wealth = 45
				quality = 45
				max_durability = 60
				generate_history = no
			}
			scope:new_trinket = {
				set_variable = lucky_coin_trinket
			}
		}
		##Uncommon 06
		###Lavender Jade Pendant
		40 = {
			#TRIGGERS
			trigger = {
				scope:trinket_receiver = {
					##If we don't already have a Lavender Jade Pendant in our inventory
					NOT = {
						any_character_artifact = { has_variable = lavender_jade_pendant_trinket }
					}
					OR = {
						##If we are flagged to grab all trinkets
						var:grab_all_trinkets ?= flag:yes
						##stewardship_general.2001
						has_character_flag = used_in_stewardship_general.2001
						##feast_default.1016
						has_character_flag = used_in_feast_default.1016
						##bp1_yearly.1021
						has_character_flag = 1021_token
						has_character_flag = used_in_mpo_events_ariana_0070
						##^^Add more/other trigger flags above^^##
					}
				}
			}
			#MODIFIERS
			##^^Add more/other modifier flags above^^##
			#DO NOT edit this part##
			create_artifact = {
				name = lavender_jade_pendant
				description = lavender_jade_pendant.desc
				type = miscellaneous
				visuals = necklace
				modifier = artifact_monthly_piety_2_modifier
				modifier = artifact_monthly_piety_from_buildings_mult_3_modifier
				save_scope_as = new_trinket
				wealth = 45
				quality = 45
				max_durability = 60
				generate_history = no
			}
			scope:new_trinket = {
				set_variable = lavender_jade_pendant_trinket
			}
		}
		#RARE - 1/35 with no modifiers
		##Rare 01
		###Old Signet Ring
		20 = {
			#TRIGGERS
			trigger = {
				scope:trinket_receiver = {
					##If we don't already have the Ring of Sekhmet in our inventory
					NOT = {
						any_character_artifact = { has_variable = sekhmet_ring_trinket }
					}
					OR = {
						##If we are flagged to grab all trinkets
						var:grab_all_trinkets ?= flag:yes
						##stewardship_general.2001
						###If we have extremely high stewardship skill
						has_character_flag = has_extremely_high_stewardship_skill_stewardship_general.2001
						##feast_default.1016
						has_character_flag = used_in_feast_default.1016
						##bp1_yearly.1021
						has_character_flag = 1021_token
						has_character_flag = used_in_mpo_events_ariana_0070
						##^^Add more/other trigger flags above^^##
					}
				}
			}
			#MODIFIERS
			##stewardship_general.2001
			###Less likely if we took the cheap option
			modifier = {
				scope:trinket_receiver = { has_character_flag = cheap_option_stewardship_general.2001 }
				add = -25
			}
			##^^Add more/other modifier flags above^^##
			#DO NOT edit this part##
			create_artifact = {
				name = sekhmet_ring
				description = sekhmet_ring.desc
				type = miscellaneous
				visuals = ring
				modifier = artifact_monthly_prestige_2_modifier
				modifier = artifact_monthly_stewardship_lifestyle_xp_1_modifier
				modifier = artifact_stewardship_1_modifier
				modifier = artifact_monthly_dynasty_prestige_3_modifier
				save_scope_as = new_trinket
				wealth = 65
				quality = 65
				history = {
					type = created_before_history
				}
			}
			scope:new_trinket = {
				set_variable = sekhmet_ring_trinket
			}
		}
		##Rare 02
		###Ancient Scarab Brooch
		20 = {
			#TRIGGERS
			trigger = {
				scope:trinket_receiver = {
					##If we don't already have the Ancient Scarab Brooch in our inventory
					NOT = {
						any_character_artifact = { has_variable = ancient_scarab_brooch_trinket }
					}
					OR = {
						##If we are flagged to grab all trinkets
						var:grab_all_trinkets ?= flag:yes
						##stewardship_general.2001
						###If we have extremely high stewardship skill, took the expensive option or had a helpful councillor
						has_character_flag = has_extremely_high_stewardship_skill_stewardship_general.2001
						has_character_flag = expensive_option_stewardship_general.2001
						AND = {
							has_character_flag = has_helpful_chaplain_stewardship_general.2001
							has_character_flag = helpful_option_stewardship_general.2001
						}
						##feast_default.1016
						has_character_flag = used_in_feast_default.1016
						##bp1_yearly.1021
						has_character_flag = 1021_token

						##^^Add more/other trigger flags above^^##
					}
				}
			}
			#MODIFIERS
			##^^Add more/other modifier flags above^^##
			#DO NOT edit this part##
			create_artifact = {
				name = scarab_brooch
				description = scarab_brooch.desc
				type = miscellaneous
				visuals = brooch
				modifier = artifact_health_gain_2_modifier
				modifier = artifact_fertility_gain_2_modifier
				modifier = artifact_negate_health_penalty_add_2_modifier
				modifier = artifact_prowess_3_modifier
				save_scope_as = new_trinket
				wealth = 65
				quality = 65
				history = {
					type = created_before_history
				}
			}
			scope:new_trinket = {
				set_variable = ancient_scarab_brooch_trinket
			}
		}
	}
	if = {
		limit = { exists = scope:new_trinket }
		#Set up history
		scope:new_trinket = {
			#Check what our history is
			save_scope_value_as = {
				name = artifact_history
				value = flag:$HISTORY_TYPE$
			}
			##Given to scope:trinket_receiver
			if = {
				limit = {
					exists = scope:artifact_history
					scope:artifact_history = flag:given_unknown
				}
				add_artifact_history = {
					type = given
					actor = scope:trinket_receiver 		#Having the receiver in both generates the CoA on the right-hand side of the entry
					recipient = scope:trinket_receiver
				}
			}
			##Given to scope:trinket_receiver (scope:trinket_giver is the left-hand portrait)
			else_if = {
				limit = {
					exists = scope:artifact_history
					scope:artifact_history = flag:given
				}
				add_artifact_history = {
					type = given
					actor = scope:trinket_giver
					recipient = scope:trinket_receiver
				}
			}
			##Discovered by scope:trinket_giver for scope:trinket_receiver at scope:trinket_giver.location
			else_if = {
				limit = {
					exists = scope:artifact_history
					scope:artifact_history = flag:discovered
				}
				add_artifact_history = {
					type = discovered
					actor = scope:trinket_giver
					recipient = scope:trinket_receiver
					location = scope:trinket_giver.location
				}
			}
			##Stolen by scope:trinket_receiver (scope:trinket_receiver's Coat of Arms is the right-hand portrait)
			else_if = {
				limit = {
					exists = scope:artifact_history
					scope:artifact_history = flag:stolen_unknown
				}
				add_artifact_history = {
					type = stolen
					actor = scope:trinket_receiver
					recipient = scope:trinket_receiver
				}
			}
			##Stolen by scope:trinket_receiver (scope:trinket_giver is the right-hand portrait)
			else_if = {
				limit = {
					exists = scope:artifact_history
					scope:artifact_history = flag:stolen
				}
				add_artifact_history = {
					type = stolen
					actor = scope:trinket_giver
					recipient = scope:trinket_receiver
				}
			}
			##Created by an unknown benefactor for scope:trinket_receiver at scope:trinket_receiver.location
			else_if = {
				limit = {
					exists = scope:artifact_history
					scope:artifact_history = flag:created_unknown
				}
				add_artifact_history = {
					type = created
					recipient = scope:trinket_receiver
					location = scope:trinket_receiver.location
				}
			}
			##Created by scope:trinket_giver for scope:trinket_receiver at scope:trinket_receiver.location
			else_if = {
				limit = {
					exists = scope:artifact_history
					scope:artifact_history = flag:created
				}
				add_artifact_history = {
					type = created
					actor = scope:trinket_giver
					recipient = scope:trinket_receiver
					location = scope:trinket_receiver.location
				}
			}
			##Inherited by scope:trinket_receiver
			else_if = {
				limit = {
					exists = scope:artifact_history
					scope:artifact_history = flag:inherited_unknown
				}
				add_artifact_history = {
					type = inherited
					actor = scope:trinket_receiver
					recipient = scope:trinket_receiver
				}
			}
			#Inherited by scope:trinket_receiver
			else_if = {
				limit = {
					exists = scope:artifact_history
					scope:artifact_history = flag:inherited
				}
				add_artifact_history = {
					type = inherited
					actor = scope:trinket_giver
					recipient = scope:trinket_receiver
				}
			}
			##Reforged by scope:trinket_receiver in scope:trinket_receiver.location
			else_if = {
				limit = {
					exists = scope:artifact_history
					scope:artifact_history = flag:reforged
				}
				add_artifact_history = {
					type = reforged
					recipient = scope:trinket_receiver
					location = scope:trinket_receiver.location
				}
			}
			##Conquered by scope:trinket_receiver in a war against scope:trinket_giver
			else_if = {
				limit = {
					exists = scope:artifact_history
					scope:artifact_history = flag:conquest
				}
				add_artifact_history = {
					type = conquest
					actor = scope:trinket_giver
					recipient = scope:trinket_receiver
				}
			}
			##Conquered by scope:trinket_receiver after the siege of scope:trinket_giver.location
			else_if = {
				limit = {
					exists = scope:artifact_history
					scope:artifact_history = flag:taken_in_siege
				}
				add_artifact_history = {
					type = taken_in_siege
					actor = scope:trinket_giver
					recipient = scope:trinket_receiver
					location = scope:trinket_giver.location
				}
			}
			##TODO_CD_FGK Taken in battle
			##TODO_CD_FGK Won in duel
		}
	}
	#Clean up the grab all flag, in case it was used
	scope:trinket_receiver = {
		if = {
			limit = { exists = var:grab_all_trinkets }
			remove_variable = grab_all_trinkets
		}
	}
	#Clean up trinket variables
	if = {
		limit = { exists = var:horned_mythical_creature }
		remove_variable = horned_mythical_creature
	}
	if = {
		limit = { exists = var:regional_mythical_creature_trinket }
		remove_variable = regional_mythical_creature_trinket
	}
	if = {
		limit = { exists = var:trinket_adjective_followup }
		remove_variable = trinket_adjective_followup
	}
}


# EP2
# If the type of weapon hasn't been decided yet we set it here
set_bow_artifact_type_effect = {
	save_temporary_scope_value_as = {
		name = allow_no_type_option
		value = $NO_TYPE$
	}
	# Historically many of these types of weapon were used in some combination, but to give a clearer portrayal to the player we have to simplify it a bit
	hidden_effect = {
		$BASE_SCOPE$ = {
			#The type has been decided in events, when the character got inspired, or now. Let's save it! (might still leave it up to the sponsor if allow_no_type_option = yes!)
			if = {
				limit = {
					NOT = { exists = var:artifact_bow_type }
				}
				random_list = { #What weapon do they want to forge?
					25 = {
						trigger = {
							culture = { has_cultural_tradition = tradition_longbow_competitions }
						}
						set_variable = {
							name = artifact_bow_type
							value = flag:artifact_bow_type_longbow
						}
					}
					10 = {
						trigger = {
							culture = { has_innovation = innovation_advanced_bowmaking }
						}
						set_variable = {
							name = artifact_bow_type
							value = flag:artifact_bow_type_crossbow
						}
					}
					5 = {
						set_variable = {
							name = artifact_bow_type
							value = flag:artifact_bow_type_bow
						}
					}
					25 = {
						trigger = {
							culture = { is_composite_bow_culture_trigger = yes }
						}
						set_variable = {
							name = artifact_bow_type
							value = flag:artifact_bow_type_composite
						}
					}
					50 = { #They don't care and you can decide!
						trigger = { scope:allow_no_type_option = yes }
						modifier = {
							add = 30
							has_personality_submissive_trigger = yes
						}
						modifier = {
							add = 9890 # ~1% chance of being predetermined if comissioning from a local artisan.
							has_character_flag = local_artisan
						}
						ai_value_modifier = {
							ai_boldness = -0.25
							ai_energy = -0.25
						}
						# Don't set on creation so that the player has more input on what gets forged in inspiration start events, like fund_inspiration.0015
					}
				}
			}
		}
	}
}

create_artifact_bow_effect = {
	# Get the character the artifact is being made for.
	# If scope:adventurer exists this will result in the history entry reading that the weapon was discovered instead of made.
	$OWNER$ = { save_scope_as = owner }
	$CREATOR$ = { save_scope_as = bowyer }
	save_temporary_scope_value_as = {
		name = bow_type_is_set
		value = $SET_BOW_TYPE$
	}
	if = { #Any existing dummy character gets turned into the bowyer
		limit = {
			exists = scope:dummy_gender
			scope:bowyer = scope:dummy_gender
		}
		clear_saved_scope = bowyer
		clear_saved_scope = dummy_gender
	}
	hidden_effect_new_object = {
		if = {
			limit = { scope:bow_type_is_set = flag:no }
			if = {
				limit = { exists = scope:bowyer }
				set_bow_artifact_type_effect = {
					BASE_SCOPE = scope:bowyer
					NO_TYPE = no
				}
				scope:bowyer = {
					var:artifact_bow_type = { save_scope_as = bow_type }
					remove_variable = artifact_bow_type
				}
			}
			else = {
				set_bow_artifact_type_effect = {
					BASE_SCOPE = scope:owner
					NO_TYPE = no
				}
				scope:owner = {
					var:artifact_bow_type = { save_scope_as = bow_type }
					remove_variable = artifact_bow_type
				}
			}
		}
		else = {
			scope:bow_type_is_set = { save_scope_as = bow_type }
		}
		# Get artifact quality and wealth.
		get_artifact_quality_effect = yes
		get_artifact_wealth_effect = yes

		# Get the type of weapon to forge. Defaults to bow if an invalid type is provided.
		if = { # Longbow
			limit = { scope:bow_type = flag:artifact_bow_type_longbow }
			if = {
				limit = { exists = scope:adventurer }
				create_artifact = {
					name = artifact_longbow_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = longbow
					type = longbow
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = {
						location = scope:location
						actor = scope:adventurer
						recipient = root
						type = discovered
					}
				}
			}
			else_if = {
				limit = {
					scope:host ?= $OWNER$
					scope:activity ?= { has_activity_type = activity_tournament }
				}
				tournament_contest_bow_prize_effect = { TYPE = longbow }
			}
			else_if = {
				limit = { exists = scope:bowyer }
				create_artifact = {
					name = artifact_longbow_name
					creator = scope:bowyer
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = longbow
					type = longbow
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
				}
			}
			else = {
				create_artifact = {
					name = artifact_longbow_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = longbow
					type = longbow
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = { type = created_before_history }
				}
			}
			scope:newly_created_artifact = {
				get_artifact_feature_references_effect = yes
				set_artifact_description = artifact_longbow_description
			}
		}
		else_if = { # Composite
			limit = { scope:bow_type = flag:artifact_bow_type_composite }
			if = {
				limit = { exists = scope:adventurer }
				create_artifact = {
					name = artifact_composite_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = composite
					type = composite
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = {
						location = scope:location
						actor = scope:adventurer
						recipient = root
						type = discovered
					}
				}
			}
			else_if = {
				limit = {
					scope:host ?= $OWNER$
					scope:activity ?= { has_activity_type = activity_tournament }
				}
				tournament_contest_bow_prize_effect = { TYPE = composite }
			}
			else_if = {
				limit = { exists = scope:bowyer }
				create_artifact = {
					name = artifact_composite_name
					creator = scope:bowyer
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = composite
					type = composite
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
				}
			}
			else = {
				create_artifact = {
					name = artifact_composite_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = composite
					type = composite
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = { type = created_before_history }
				}
			}
			scope:newly_created_artifact = {
				get_artifact_feature_references_effect = yes
				set_artifact_description = artifact_composite_description
			}
		}
		else_if = { # Crossbow
			limit = { scope:bow_type = flag:artifact_bow_type_crossbow }
			if = {
				limit = { exists = scope:adventurer }
				create_artifact = {
					name = artifact_crossbow_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = crossbow
					type = crossbow
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = {
						location = scope:location
						actor = scope:adventurer
						recipient = root
						type = discovered
					}
				}
			}
			else_if = {
				limit = {
					scope:host ?= $OWNER$
					scope:activity ?= { has_activity_type = activity_tournament }
				}
				tournament_contest_bow_prize_effect = { TYPE = crossbow }
			}
			else_if = {
				limit = { exists = scope:bowyer }
				create_artifact = {
					name = artifact_crossbow_name
					creator = scope:bowyer
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = crossbow
					type = crossbow
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
				}
			}
			else = {
				create_artifact = {
					name = artifact_crossbow_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = crossbow
					type = crossbow
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = { type = created_before_history }
				}
			}
			scope:newly_created_artifact = {
				get_artifact_feature_references_effect = yes
				set_artifact_description = artifact_crossbow_description
			}
		}
		else_if = { # Standard
			limit = { scope:bow_type = flag:artifact_bow_type_bow }
			if = {
				limit = { exists = scope:adventurer }
				create_artifact = {
					name = artifact_bow_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = bow
					type = bow
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = {
						location = scope:location
						actor = scope:adventurer
						recipient = root
						type = discovered
					}
				}
			}
			else_if = {
				limit = {
					scope:host ?= $OWNER$
					scope:activity ?= { has_activity_type = activity_tournament }
				}
				tournament_contest_bow_prize_effect = { TYPE = bow }
			}
			else_if = {
				limit = { exists = scope:smith }
				create_artifact = {
					name = artifact_bow_name
					creator = scope:smith
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = bow
					type = bow
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
				}
			}
			else = {
				create_artifact = {
					name = artifact_bow_name
					description = placeholder # Will be re-generated once decorations are added in the post-creation effects.
					visuals = bow
					type = bow
					modifier = artifact_prowess_1_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact
					history = { type = created_before_history }
				}
			}
			scope:newly_created_artifact = {
				get_artifact_feature_references_effect = yes
				set_artifact_description = artifact_bow_description
			}
		}
		scope:newly_created_artifact = {
			# Prowess from weapon rarity
			add_scaled_artifact_modifier_prowess_effect = yes
			add_scaled_artifact_modifier_trait_track_hunter_xp_gain_mult_effect = yes
			if = {
				limit = {
					OR = {
						rarity = famed
						rarity = illustrious
					}
				}
				if = {
					limit = { scope:bow_type = flag:artifact_bow_type_composite }
					add_scaled_artifact_modifier_archer_cavalry_screen_add_effect = yes
				}
				else_if = {
					limit = { scope:bow_type = flag:artifact_bow_type_longbow }
					add_scaled_artifact_modifier_archers_screen_add_effect = yes
				}
				else = { add_2_scaled_artifact_modifier_combat_effect = yes }
			}
			else_if = {
				limit = {
					OR = {
						rarity = common
						rarity = masterwork
					}
				}
				if = {
					limit = { scope:bow_type = flag:artifact_bow_type_composite }
					add_scaled_artifact_modifier_archer_cavalry_screen_add_effect = yes
				}
				else_if = {
					limit = { scope:bow_type = flag:artifact_bow_type_longbow }
					add_scaled_artifact_modifier_archers_screen_add_effect = yes
				}
				else = { add_2_scaled_artifact_modifier_combat_effect = yes }
			}
			else_if = {
				limit = {
					OR = {
						rarity = famed
						rarity = illustrious
					}
					# No decorations
				}
				if = {
					limit = { scope:bow_type = flag:artifact_bow_type_composite }
					add_scaled_artifact_modifier_archer_cavalry_screen_add_effect = yes
				}
				else_if = {
					limit = { scope:bow_type = flag:artifact_bow_type_longbow }
					add_scaled_artifact_modifier_archers_screen_add_effect = yes
				}
				else = { add_2_scaled_artifact_modifier_combat_effect = yes }
			}
			else_if = {
				limit = {
					rarity = masterwork
					# No decorations
				}
				if = {
					limit = { scope:bow_type = flag:artifact_bow_type_composite }
					add_scaled_artifact_modifier_archer_cavalry_screen_add_effect = yes
				}
				else_if = {
					limit = { scope:bow_type = flag:artifact_bow_type_longbow }
					add_scaled_artifact_modifier_archers_screen_add_effect = yes
				}
				else = { add_2_scaled_artifact_modifier_combat_effect = yes }
			}
			else = { add_artifact_modifier = artifact_prowess_no_decorations_modifier }
			# Save the quality and wealth of this artifact in case we need to reference it later.
			set_variable = {
				name = quality
				value = scope:quality
			}
			set_variable = {
				name = wealth
				value = scope:wealth
			}
		}
	}
}

create_artifact_ring_effect = {
	# Get the character the artifact is being made for.
	$OWNER$ = { save_scope_as = owner }
	$SMITH$ = { save_scope_as = goldsmith }
	if = { #Any existing dummy character gets turned into the goldsmith
		limit = {
			exists = scope:dummy_gender
			scope:goldsmith = scope:dummy_gender
		}
		clear_saved_scope = goldsmith
		clear_saved_scope = dummy_gender
	}
	hidden_effect_new_object = {
		# Get artifact quality, wealth, materials, and decorations
		get_artifact_quality_effect = yes
		get_artifact_wealth_effect = yes

		# Create the artifact
		if = {
			limit = { exists = scope:adventurer }
			create_artifact = {
				name = artifact_ring_name
				description = placeholder
				visuals = ring
				type = ring
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
				history = {
					location = scope:location
					actor = scope:adventurer
					recipient = root
					type = discovered
				}
			}
		}
		else_if = {
			limit = {
				scope:host ?= $OWNER$
				scope:activity ?= { has_activity_type = activity_tournament }
			}
			create_artifact = {
				name = artifact_ring_name
				creator = scope:host
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = ring
				type = ring
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
				history = {
					type = prize_created
					recipient = scope:host
				}
			}
		}
		else_if = {
			limit = { 
				exists = scope:goldsmith
				exists = scope:owner 
				scope:goldsmith = scope:owner 
			}
			create_artifact = {
				name = artifact_ring_name
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = ring
				type = ring
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				history = {
					type = created
					actor = scope:goldsmith
					recipient = scope:goldsmith
					location = scope:goldsmith.location
				}
				save_scope_as = newly_created_artifact
			}
		}
		else_if = {
			limit = { exists = scope:norman_noble }
			create_artifact = {
				name = artifact_ring_name
				creator = scope:host
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = ring
				type = ring
				modifier = artifact_placeholder_modifier
				wealth = 120
				quality = 120
				save_scope_as = newly_created_artifact
			}
		}
		else_if = {
			limit = { exists = scope:goldsmith }
			create_artifact = {
				name = artifact_ring_name
				creator = scope:goldsmith
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = ring
				type = ring
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
			}
		}
		else = {
			create_artifact = {
				name = artifact_ring_name
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = ring
				type = ring
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
				history = { type = created_before_history }
			}
		}
		scope:newly_created_artifact = {
			# Finish generating decorations and update description
			if = {
				limit = {
					OR = {
						has_artifact_feature = ring_decoration_adornment
						has_artifact_feature = ring_decoration_centerpiece_and_adornment
					}
				}
				set_artifact_feature_group = ring_adornment
			}
			if = {
				limit = {
					OR = {
						has_artifact_feature = ring_decoration_centerpiece
						has_artifact_feature = ring_decoration_centerpiece_and_adornment
					}
				}
				set_artifact_feature_group = ring_centerpiece
			}
			get_artifact_feature_references_effect = yes
			set_artifact_description = artifact_ring_description

			# Add artifact modifiers
			add_scaled_artifact_modifier_minor_prestige_effect = yes
			if = {
				limit = {
					OR = {
						has_artifact_feature = ring_adornment_motto
						has_artifact_feature = ring_centerpiece_signet
					}
				}
				add_scaled_artifact_modifier_majesty_effect = yes
			}
			else = { add_scaled_artifact_modifier_attractiveness_effect = yes }
			if = {
				limit = {
					OR = {
						rarity = famed
						rarity = illustrious
					}
				}
				add_scaled_artifact_modifier_rulership_effect = yes
			}
			set_variable = {
				name = quality
				value = scope:quality
			}
			set_variable = {
				name = wealth
				value = scope:wealth
			}
		}
	}
}

create_artifact_bowl_effect = {
	# Get the character the artifact is being made for.
	$OWNER$ = { save_scope_as = owner }
	$SMITH$ = { save_scope_as = goldsmith }
	if = { #Any existing dummy character gets turned into the goldsmith
		limit = {
			exists = scope:dummy_gender
			scope:goldsmith = scope:dummy_gender
		}
		clear_saved_scope = goldsmith
		clear_saved_scope = dummy_gender
	}
	hidden_effect_new_object = {
		# Get artifact quality, wealth, materials, and decorations
		get_artifact_quality_effect = yes
		get_artifact_wealth_effect = yes

		# Create the artifact
		if = {
			limit = { exists = scope:adventurer }
			create_artifact = {
				name = artifact_bowl_name
				description = placeholder
				visuals = bowl
				type = bowl
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
				history = {
					location = scope:location
					actor = scope:adventurer
					recipient = root
					type = discovered
				}
			}
		}
		else_if = {
			limit = {
				scope:host ?= $OWNER$
				scope:activity ?= { has_activity_type = activity_tournament }
			}
			create_artifact = {
				name = artifact_bowl_name
				creator = scope:host
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = bowl
				type = bowl
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				history = {
					type = prize_created
					recipient = scope:host
				}
				save_scope_as = newly_created_artifact
			}
		}
		else_if = {
			limit = { exists = scope:goldsmith }
			create_artifact = {
				name = artifact_bowl_name
				creator = scope:goldsmith
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = bowl
				type = bowl
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
			}
		}
		else = {
			create_artifact = {
				name = artifact_bowl_name
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = bowl
				type = bowl
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
				history = { type = created_before_history }
			}
		}

		scope:newly_created_artifact = {
			# Finish generating decorations and update description
			get_artifact_feature_references_effect = yes
			set_artifact_description = artifact_bowl_description
			# Add artifact modifiers
			add_scaled_artifact_modifier_minor_prestige_effect = yes
			add_scaled_artifact_modifier_grandeur_small_effect = yes
			if = {
				limit = {
					OR = {
						rarity = famed
						rarity = illustrious
					}
				}
				add_scaled_artifact_modifier_rulership_effect = yes
			}
			set_variable = {
				name = quality
				value = scope:quality
			}
			set_variable = {
				name = wealth
				value = scope:wealth
			}
		}
	}
}

create_artifact_plate_effect = {
	# Get the character the artifact is being made for.
	$OWNER$ = { save_scope_as = owner }
	$SMITH$ = { save_scope_as = goldsmith }
	if = { #Any existing dummy character gets turned into the goldsmith
		limit = {
			exists = scope:dummy_gender
			scope:goldsmith = scope:dummy_gender
		}
		clear_saved_scope = goldsmith
		clear_saved_scope = dummy_gender
	}
	hidden_effect_new_object = {
		# Get artifact quality, wealth, materials, and decorations
		get_artifact_quality_effect = yes
		get_artifact_wealth_effect = yes

		# Create the artifact
		if = {
			limit = { exists = scope:adventurer }
			create_artifact = {
				name = artifact_plate_name
				description = placeholder
				visuals = plate
				type = plate
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
				history = {
					location = scope:location
					actor = scope:adventurer
					recipient = root
					type = discovered
				}
			}
		}
		else_if = {
			limit = {
				scope:host ?= $OWNER$
				scope:activity ?= { has_activity_type = activity_tournament }
			}
			create_artifact = {
				name = artifact_plate_name
				creator = scope:host
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = plate
				type = plate
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				history = {
					type = prize_created
					recipient = scope:host
				}
				save_scope_as = newly_created_artifact
			}
		}
		else_if = {
			trigger = { exists = scope:goldsmith }
			create_artifact = {
				name = artifact_plate_name
				creator = scope:goldsmith
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = plate
				type = plate
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
			}
		}
		else = {
			create_artifact = {
				name = artifact_plate_name
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = plate
				type = plate
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
				history = { type = created_before_history }
			}
		}
		scope:newly_created_artifact = {
			# Finish generating decorations and update description
			get_artifact_feature_references_effect = yes
			set_artifact_description = artifact_plate_description
			# Add artifact modifiers
			add_scaled_artifact_modifier_minor_prestige_effect = yes
			add_scaled_artifact_modifier_grandeur_small_effect = yes
			if = {
				limit = {
					OR = {
						rarity = famed
						rarity = illustrious
					}
				}
				add_scaled_artifact_modifier_rulership_effect = yes
			}
			set_variable = {
				name = quality
				value = scope:quality
			}
			set_variable = {
				name = wealth
				value = scope:wealth
			}
		}
	}
}

create_artifact_urn_effect = {
	# Get the character the artifact is being made for.
	$OWNER$ = { save_scope_as = owner }
	$POTTER$ = { save_scope_as = potter }
	if = { #Any existing dummy character gets turned into the potter
		limit = {
			exists = scope:dummy_gender
			scope:potter = scope:dummy_gender
		}
		clear_saved_scope = potter
		clear_saved_scope = dummy_gender
	}
	hidden_effect_new_object = {
		# Get artifact quality, wealth, materials, and decorations
		get_artifact_quality_effect = yes
		get_artifact_wealth_effect = yes

		# Create the artifact
		if = {
			limit = { exists = scope:adventurer }
			create_artifact = {
				name = artifact_urn_name
				description = placeholder
				visuals = urn
				type = urn
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
				history = {
					location = scope:location
					actor = scope:adventurer
					recipient = root
					type = discovered
				}
			}
		}
		else_if = {
			limit = {
				scope:host ?= $OWNER$
				scope:activity ?= { has_activity_type = activity_tournament }
			}
			create_artifact = {
				name = artifact_urn_name
				creator = scope:host
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = urn
				type = urn
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				history = {
					type = prize_created
					recipient = scope:host
				}
				save_scope_as = newly_created_artifact
			}
		}
		else_if = {
			limit = { exists = scope:potter }
			create_artifact = {
				name = artifact_urn_name
				creator = scope:potter
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = urn
				type = urn
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
			}
		}
		else = {
			create_artifact = {
				name = artifact_urn_name
				description = placeholder # Will be updated in the post-creation effects after decorations are assigned.
				visuals = urn
				type = urn
				modifier = artifact_placeholder_modifier
				wealth = scope:wealth
				quality = scope:quality
				save_scope_as = newly_created_artifact
				history = { type = created_before_history }
			}
		}
		scope:newly_created_artifact = {
			# Finish generating decorations and update description
			get_artifact_feature_references_effect = yes
			set_artifact_description = artifact_urn_description
			# Add artifact modifiers
			add_scaled_artifact_modifier_grandeur_small_effect = yes
			add_scaled_artifact_modifier_minor_prestige_effect = yes
			if = {
				limit = {
					OR = {
						rarity = famed
						rarity = illustrious
					}
				}
				add_scaled_artifact_modifier_majesty_effect = yes
			}
			set_variable = {
				name = quality
				value = scope:quality
			}
			set_variable = {
				name = wealth
				value = scope:wealth
			}
		}
	}
}

hunt_animal_artifact_modifier_selection_effect = {
	if = {
		limit = {
			OR = {
				rarity = masterwork
				rarity = famed
				rarity = illustrious
			}
		}
		if = {
			limit = {
				OR = {
					scope:owner.var:animal_type ?= flag:hare
				}
			}
			add_scaled_artifact_modifier_attractiveness_effect = yes
			if = {
				limit = {
					rarity = illustrious
				}
				add_scaled_artifact_modifier_intrigue_effect = yes
			}
		}
		else_if = {
			limit = {
				OR = {
					scope:owner.var:animal_type ?= flag:roe
					scope:owner.var:animal_type ?= flag:reindeer
					scope:owner.var:animal_type ?= flag:stag
					scope:owner.var:animal_type ?= flag:antelope
					scope:owner.var:animal_type ?= flag:saiga
					scope:owner.var:animal_type ?= flag:hart
					scope:owner.var:animal_type ?= flag:elk
					scope:owner.var:animal_type ?= flag:horse
				}
			}
			add_scaled_artifact_modifier_majesty_effect = yes
			if = {
				limit = {
					rarity = illustrious
				}
				add_scaled_artifact_modifier_minor_prestige_effect = yes
			}
		}
		else_if = {
			limit = {
				OR = {
					scope:owner.var:animal_type ?= flag:aurochs
					scope:owner.var:animal_type ?= flag:bison
					scope:owner.var:animal_type ?= flag:boar
				}
			}
			add_scaled_artifact_modifier_rulership_effect = yes
			if = {
				limit = {
					rarity = illustrious
				}
				add_scaled_artifact_modifier_majesty_effect = yes
			}
		}
		else_if = {
			limit = {
				OR = {
					scope:owner.var:animal_type ?= flag:bear
					scope:owner.var:animal_type ?= flag:leopard
					scope:owner.var:animal_type ?= flag:lion
					scope:owner.var:animal_type ?= flag:tiger
					scope:owner.var:animal_type ?= flag:wolf
					scope:owner.var:animal_type ?= flag:lynx
					scope:owner.var:animal_type ?= flag:wolf
					scope:owner.var:animal_type ?= flag:dog
				}
			}
			add_scaled_artifact_modifier_combat_effect = yes
			if = {
				limit = {
					rarity = illustrious
				}
				add_scaled_artifact_modifier_majesty_effect = yes
			}
		}
		else_if = {
			limit = {
				OR = {
					scope:owner.var:animal_type ?= flag:hyena
					scope:owner.var:animal_type ?= flag:unicorn
					scope:owner.var:animal_type ?= flag:fox
					scope:owner.var:animal_type ?= flag:dragon
					scope:owner.var:animal_type ?= flag:cat
				}
			}
			add_scaled_artifact_modifier_intrigue_effect = yes
			if = {
				limit = {
					rarity = illustrious
				}
				add_scaled_artifact_modifier_scholarship_effect = yes
			}
		}
		else = {
			add_scaled_artifact_modifier_majesty_effect = yes
			if = {
				limit = {
					rarity = illustrious
				}
				add_scaled_artifact_modifier_rulership_effect = yes
			}
		}
	}
}

generate_health_trinket_effect = {
	#Get artifact quality and wealth
	get_artifact_quality_effect = yes
	get_artifact_wealth_effect = yes
	#Generate the trinket
	hidden_effect_new_object = {
		random_list = {
			25 = {
				create_artifact = {
					name = medicine_jar
					description = medicine_jar_desc
					type = miscellaneous
					visuals = glazed_jar
					modifier = artifact_epidemic_resistance_3_modifier
					save_scope_as = newly_created_health_artifact
					wealth = scope:wealth
					quality = scope:quality
				}
				scope:newly_created_health_artifact = { set_variable = health_jar }
			}
			25 = {
				create_artifact = {
					name = lapidary_tourmaline
					description = lapidary_tourmaline.desc
					type = miscellaneous
					visuals = diamond
					modifier = artifact_negate_health_penalty_add_2_modifier
					save_scope_as = newly_created_health_artifact
					wealth = scope:wealth
					quality = scope:quality
					generate_history = no
				}
				scope:newly_created_health_artifact = { set_variable = health_jewel }
			}
			25 = {
				create_artifact = {
					name = scented_herb_pouch
					description = scented_herb_pouch.desc
					type = miscellaneous
					visuals = pocket_pouch
					modifier = artifact_health_gain_2_modifier
					save_scope_as = newly_created_health_artifact
					wealth = scope:wealth
					quality = scope:quality
				}
				scope:newly_created_health_artifact = { set_variable = health_pouch }
			}
			25 = {
				set_up_horned_mythical_creature_effect = yes
				create_artifact = {
					name = mythical_creature_horn
					description = mythical_creature_horn.desc
					type = miscellaneous
					visuals = pocket_tusk
					modifier = artifact_fertility_gain_2_modifier
					save_scope_as = newly_created_health_artifact
					wealth = scope:wealth
					quality = scope:quality
					generate_history = no
				}
				scope:newly_created_health_artifact = { set_variable = health_horn }
				remove_variable ?= horned_mythical_creature
			}
		}
		#Tweak the trinket modifiers, depending on rarity
		scope:newly_created_health_artifact = {
			if = { #Famed
				limit = { 
					OR = {
						rarity = illustrious #Bit of a cop-out, but I only need up to Famed atm
						rarity = famed 
					}
				}
				clear_artifact_modifiers = yes
				switch = {
					trigger = has_variable
					health_jar = {
						set_artifact_name = aged_medicine_jar
						add_artifact_modifier = artifact_epidemic_resistance_7_modifier
						add_artifact_modifier = artifact_negate_health_penalty_add_2_modifier
					}
					health_jewel = { 
						random_list = {
							75 = {
								set_artifact_name = lapidary_sapphire
								set_artifact_description = lapidary_sapphire.desc
							}
							25 = {
								modifier = {
									root.location = { geographical_region = world_india }
									factor = 2
								}
								set_artifact_name = lapidary_ruby
								set_artifact_description = lapidary_ruby.desc
							}
						}
						add_artifact_modifier = artifact_negate_health_penalty_add_3_modifier
						add_artifact_modifier = artifact_fertility_gain_2_modifier
					}
					health_pouch = { 
						set_artifact_name = pomander
						set_artifact_description = pomander.desc
						add_artifact_modifier = artifact_health_gain_4_modifier
						add_artifact_modifier = artifact_epidemic_resistance_5_modifier
					}
					health_horn = { 
						add_artifact_modifier = artifact_fertility_gain_4_modifier
						add_artifact_modifier = artifact_health_gain_2_modifier
					}
				}
			}
			else_if = { #Masterwork
				limit = { rarity = masterwork }
				clear_artifact_modifiers = yes
				switch = {
					trigger = has_variable
					health_jar = {
						set_artifact_name = potent_medicine_jar
						add_artifact_modifier = artifact_epidemic_resistance_5_modifier
						add_artifact_modifier = artifact_negate_health_penalty_add_1_modifier
					}
					health_jewel = { 
						random_list = {
							50 = {
								set_artifact_name = lapidary_jasper
								set_artifact_description = lapidary_jasper.desc
							}
							50 = {
								set_artifact_name = lapidary_garnet
								set_artifact_description = lapidary_garnet.desc
							}
						}
						add_artifact_modifier = artifact_negate_health_penalty_add_2_modifier
						add_artifact_modifier = artifact_fertility_gain_1_modifier
					}
					health_pouch = { 
						add_artifact_modifier = artifact_health_gain_3_modifier
						add_artifact_modifier = artifact_epidemic_resistance_3_modifier
					}
					health_horn = { 
						add_artifact_modifier = artifact_fertility_gain_3_modifier
						add_artifact_modifier = artifact_health_gain_1_modifier
					}
				}
			}
			#Mix up the gems a bit
			else_if = { 
				limit = {
					rarity = common
					has_variable = health_jewel
				}
				random_list = {
					50 = {
						set_artifact_name = lapidary_turquoise
						set_artifact_description = lapidary_turquoise.desc
					}
					50 = {
						set_artifact_name = lapidary_tigerseye
						set_artifact_description = lapidary_tigerseye.desc	
					}
					50 = {
						#Keep Tourmaline
					}
				}
			}
		}
	}
}

generate_historical_artifact_based_on_location_effect = {
	random_list = {
		2 = { #Ark of the covenant
			trigger = {
				NOT = {
					any_artifact = { has_variable = ark_of_the_covenant }
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east
						geographical_region = world_africa_north_east
						geographical_region = world_africa_east
					}
				}
			}
			create_artifact_sculpture_ark_of_covenant_effect = { OWNER = root }
		}
		2 = { #Babr E Bayan
			trigger = {
				NOT = {
					any_artifact = { has_variable = babr_e_bayan }
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east_persia
						#geographical_region = world_steppe
						culture = { has_cultural_pillar = heritage_iranian }
					}
				}
			}
			create_artifact_sculpture_babr_e_bayan_effect = { OWNER = root }
		}
		10 = { #Crown of Justinian
			trigger = {
				NOT = {
					any_artifact = { has_variable = crown_of_justinian }
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = custom_eastern_roman_empire
						culture = { has_cultural_pillar = heritage_byzantine }
					}
				}
			}
			create_artifact_pedestal_justinian_effect = { OWNER = root }
		}
		10 = { #Cup of Jamshid
			trigger = {
				NOT = {
					any_artifact = { has_variable = cup_jamshid }
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east_persia
						culture = { has_cultural_pillar = heritage_iranian }
					}
				}
			}
			create_artifact_pedestal_cup_jamshid_effect = { OWNER = root }
		}
		10 = { #Harp of David
			trigger = {
				NOT = {
					any_artifact = { has_variable = david_harp }
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east_jerusalem
						culture = { has_cultural_pillar = heritage_israelite }
						faith.religion = religion:judaism_religion
					}
				}
			}
			create_artifact_pedestal_david_harp_effect = { OWNER = root }
		}
		10 = { #Iron Crown - Recreate if lost
			trigger = {
				NOT = {
					any_artifact = { has_variable = iron_crown }
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = custom_northern_italy
						culture = { has_cultural_pillar = heritage_latin }
					}
				}
			}
			create_artifact_pedestal_crown_iron_effect = { OWNER = root }
		}
		10 = { #Kaviani Banner
			trigger = {
				NOT = {
					any_artifact = { has_variable = banner_kaviani }
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east_persia
						#geographical_region = world_steppe
						culture = { has_cultural_pillar = heritage_iranian }
					}
				}
			}
			create_artifact_wall_banner_kaviani_effect = { OWNER = root }
		}
		10 = { #Edessa Banner
			trigger = {
				NOT = {
					any_artifact = { has_variable = banner_edessa }
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east
						geographical_region = world_asia_minor
					}
				}
			}
			create_artifact_wall_banner_edessa_effect = { OWNER = root }
		}
		10 = { #El Cid's Sword
			trigger = {
				current_year >= 1097
				NOT = {
					any_artifact = { has_variable = sword_cid }
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east
						geographical_region = world_asia_minor
					}
				}
			}
			create_artifact_wall_cid_sword_effect = { OWNER = root }
		}
		10 = { #Muhammad's Sword
			trigger = {
				any_artifact = {
					count < 9
					has_variable = sword_of_muhammad
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east
						geographical_region = world_asia_minor
						geographical_region = world_africa_north_east
						religion = religion:islam_religion
					}
				}
			}
			create_artifact_wall_muhammad_sword_effect = { OWNER = root }
		}
		10 = { #Attila's Sword
			trigger = {
				NOT = {
					any_artifact = { has_variable = sword_attila }
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = custom_south_slavia
						geographical_region = custom_carpathia
						geographical_region = ghw_region_crimea
						geographical_region = custom_bavaria
					}
				}
			}
			create_artifact_wall_sword_attila_effect = { OWNER = root }
		}
		10 = { #Throne of Scone
			trigger = {
				NOT = {
					any_artifact = { has_variable = throne_scone }
				}
				$LOCATION$ ?= { geographical_region = world_europe_west_britannia }
			}
			create_artifact_throne_scone_effect = { OWNER = root }
		}
		10 = { #Throne of Solomon
			trigger = {
				NOT = {
					any_artifact = { has_variable = throne_of_solomon }
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east_jerusalem
						culture = { has_cultural_pillar = heritage_israelite }
						faith.religion = religion:judaism_religion
					}
				}
			}
			create_artifact_throne_solomon_effect = { OWNER = root }
		}
		10 = { #Throne of Charlemagne - Recreate if lost
			trigger = {
				NOT = {
					any_artifact = { has_variable = charlamagne_throne }
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = custom_carolingian_francia
						geographical_region = custom_carolingian_germany
						geographical_region = custom_lotharingia
						geographical_region = custom_northern_italy
					}
				}
			}
			create_artifact_throne_charlemagne_effect = { OWNER = root }
		}
		15 = { #Excalibur
			trigger = {
				any_artifact = {
					count < 6
					has_variable = excalibur
				}
				$LOCATION$ ?= {
					geographical_region = world_europe_west_britannia
				}
			}
			create_artifact_excalibur_effect = { OWNER = root }
		}
		10 = { #Head of St Edmund
			trigger = {
				NOT = {
					any_artifact = {
						has_variable = edmund_head
					}
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_europe_west_britannia
						geographical_region = world_europe_north
					}
				}
			}
			create_artifact_edmund_head_effect = { OWNER = root }
		}
		10 = { #Dhammapada
			trigger = {
				any_artifact = {
					count < 10
					has_variable = dhammapada
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_india
						geographical_region = world_tibet
						geographical_region = ghw_region_afghanistan
						religion = religion:buddhism_religion
					}
				}
			}
			create_artifact_dhammapada_effect = { OWNER = root }
		}
		10 = { #Sutta Pitaka
			trigger = {
				any_artifact = {
					count < 10
					has_variable = vinaya_pitaka
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_india
						geographical_region = world_tibet
						geographical_region = ghw_region_afghanistan
						religion = religion:buddhism_religion
					}
				}
			}
			create_artifact_sutta_pitaka_effect = { OWNER = root }
		}
		10 = { #Vinaya Pitaka
			trigger = {
				any_artifact = {
					count < 10
					has_variable = sutta_pitaka
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_india
						geographical_region = world_tibet
						geographical_region = ghw_region_afghanistan
						religion = religion:buddhism_religion
					}
				}
			}
			create_artifact_vinaya_pitaka_effect = { OWNER = root }
		}
		10 = { #Abhidhamma
			trigger = {
				any_artifact = {
					count < 10
					has_variable = abhidhamma
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_india
						geographical_region = world_tibet
						geographical_region = ghw_region_afghanistan
						religion = religion:buddhism_religion
					}
				}
			}
			create_artifact_abhidhamma_pitaka_effect = { OWNER = root }
		}
		15 = { #Jewelled Danda
			trigger = {
				any_artifact = {
					count < 10
					has_variable = danda
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_india
						geographical_region = world_tibet
						geographical_region = ghw_region_afghanistan
					}
				}
			}
			create_artifact_jewelled_danda_effect = { OWNER = ROOT }
		}
		5 = { #Mountain of Light
			trigger = {
				any_artifact = {
					count < 1
					has_variable = koh_i_noor
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_india
						geographical_region = world_tibet
						geographical_region = ghw_region_afghanistan
					}
				}
			}
			create_artifact_pedestal_koh_i_noor_effect = { OWNER = ROOT }
		}
		10 = { #Makarakundala
			trigger = {
				any_artifact = {
					count < 10
					has_variable = makarakundala
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_india
						geographical_region = world_tibet
						geographical_region = ghw_region_afghanistan
					}
				}
			}
			create_artifact_makarakundala_effect = { OWNER = ROOT }
		}
		10 = { #Great Diamond
			trigger = {
				any_artifact = {
					count < 1
					has_variable = great_diamond
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_india
						geographical_region = world_tibet
						geographical_region = ghw_region_afghanistan
					}
				}
			}
			create_artifact_pedestal_great_diamond_effect = { OWNER = ROOT }
		}
		10 = { #Al Taj
			trigger = {
				any_artifact = {
					count < 1
					has_variable = al_taj
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east
						geographical_region = world_africa_north_east
					}
				}
			}
			create_artifact_al_taj_crown_effect = { OWNER = ROOT }
		}
		10 = { #al-Sayf al-Khass
			trigger = {
				any_artifact = {
					count < 1
					has_variable = al_sayf_al_khass
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east
						geographical_region = world_africa_north_east
					}
				}
			}
			create_artifact_al_sayf_al_khass_effect = { OWNER = ROOT }
		}
		10 = { #Qadib al-Mulk
			trigger = {
				any_artifact = {
					count < 1
					has_variable = qadib_al_mulk
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east
						geographical_region = world_africa_north_east
					}
				}
			}
			create_artifact_qadib_al_mulk_effect = { OWNER = ROOT }
		}
		10 = { #Al Dawat
			trigger = {
				any_artifact = {
					count < 1
					has_variable = al_dawat
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east
						geographical_region = world_africa_north_east
					}
				}
			}
			create_artifact_al_dawat_effect = { OWNER = ROOT }
		}
		10 = { #Al Hafir
			trigger = {
				any_artifact = {
					count < 1
					has_variable = al_hafir
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east
						geographical_region = world_africa_north_east
					}
				}
			}
			create_artifact_al_hafir_effect = { OWNER = ROOT }
		}
		2 = { #Banner of thankfulness
			trigger = {
				any_artifact = {
					count < 2
					has_variable = banner_thankfulness
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east
						geographical_region = world_africa_north_east
					}
				}
			}
			create_artifact_wall_banner_thankfulness_effect = { OWNER = ROOT }
		}
		5 = { #Al Jabal
			trigger = {
				any_artifact = {
					count < 1
					has_variable = al_jabal
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east
						geographical_region = world_middle_east_persia
					}
				}
			}
			create_artifact_pedestal_al_jabal_effect = { OWNER = ROOT }
		}
		5 = { #Al Yatima
			trigger = {
				any_artifact = {
					count < 1
					has_variable = al_yatima
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east
						geographical_region = world_africa_north_east
					}
				}
			}
			create_artifact_pedestal_al_yatima_effect = { OWNER = ROOT }
		}
		10 = { #Dagger of Rostam
			trigger = {
				any_artifact = {
					count < 1
					has_variable = dagger_of_rostam
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_asia_minor
						geographical_region = world_middle_east
						geographical_region = world_middle_east_persia
					}
				}
			}
			create_artifact_dagger_of_rostam_effect = { OWNER = ROOT }
		}
		10 = { #Ascalon
			trigger = {
				any_artifact = {
					count < 1
					has_variable = ascalon
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_asia_minor
						geographical_region = world_middle_east
						geographical_region = world_middle_east_persia
					}
				}
			}
			create_artifact_ascalon_effect = { OWNER = ROOT }
		}
		10 = { #Shamshir-e Zomorrodnegar
			trigger = {
				any_artifact = {
					count < 1
					has_variable = zomorrodnegar
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_asia_minor
						geographical_region = world_middle_east
						geographical_region = world_middle_east_persia
					}
				}
			}
			create_artifact_zomorrodnegar_effect = { OWNER = ROOT }
		}
		15 = { #Muhammads epistles
			trigger = {
				any_artifact = {
					count < 12
					has_variable = muhammads_epistles
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_asia_minor
						geographical_region = world_middle_east
						geographical_region = world_middle_east_persia
					}
				}
			}
			create_artifact_muhammads_epistles_effect = { OWNER = ROOT }
		}
		10 = { #Kave's Apron
			trigger = {
				any_artifact = {
					count < 1
					has_variable = kaves_apron
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_asia_minor
						geographical_region = world_middle_east
						geographical_region = world_middle_east_persia
					}
				}
			}
			create_artifact_kaves_apron_effect = { OWNER = ROOT }
		}
		2 = { #Armor of Alexander the Great
			trigger = {
				any_artifact = {
					count < 1
					has_variable = arms_of_alex
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_india
						geographical_region = world_asia_minor
						geographical_region = world_middle_east
						geographical_region = world_middle_east_persia
					}
				}
			}
			create_artifact_arms_of_alexander_effect = { OWNER = ROOT }
		}
		10 = { #Olifant
			trigger = {
				any_artifact = {
					count < 1
					has_variable = olifant
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_europe_west
						geographical_region = world_europe_south
					}
				}
			}
			create_artifact_olifant_effect = { OWNER = ROOT }
		}
		10 = { #Angelicas Ring
			trigger = {
				any_artifact = {
					count < 1
					has_variable = angelica_ring
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_europe_west
						geographical_region = world_europe_south
					}
				}
			}
			create_artifact_angelicas_ring_effect = { OWNER = ROOT }
		}
		10 = { #Colada
			trigger = {
				any_artifact = {
					count < 1
					has_variable = colada
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_europe_west
						geographical_region = world_europe_south
					}
				}
			}
			create_colada_effect = { OWNER = ROOT }
		}
		10 = { #Curtana
			trigger = {
				any_artifact = {
					count < 1
					has_variable = curtana
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_europe_west
						geographical_region = world_europe_south
					}
				}
			}
			create_artifact_curtana_effect = { OWNER = ROOT }
		}
		10 = { #Durendal
			trigger = {
				any_artifact = {
					count < 1
					has_variable = durendal
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_europe_west
						geographical_region = world_europe_south
					}
				}
			}
			create_artifact_durendal_effect = { OWNER = ROOT }
		}
		10 = { #Joyeuse
			trigger = {
				any_artifact = {
					count < 1
					has_variable = joyeuse
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_europe_west
						geographical_region = world_europe_south
					}
				}
			}
			create_artifact_joyeuse_effect = { OWNER = ROOT }
		}
		10 = { #Aram
			trigger = {
				any_artifact = {
					count < 1
					has_variable = aram
				}
				$LOCATION$ ?= { geographical_region = world_steppe }
			}
			create_artifact_aram_effect = { OWNER = ROOT }
		}
		10 = { #Mmaagha Kamalu
			trigger = {
				any_artifact = {
					count < 1
					has_variable = mmaagha_kamalu
				}
				$LOCATION$ ?= { geographical_region = world_africa_west }
			}
			create_artifact_sword_mmaagha_kamalu_effect = { OWNER = ROOT }
		}
		15 = { #Ikenga
			trigger = {
				any_artifact = {
					count < 15
					has_variable = ikenga
				}
				$LOCATION$ ?= { geographical_region = world_africa_west }
			}
			create_artifact_pedestal_ikenga_effect = { OWNER = ROOT }
		}
		15 = { #Ibeji
			trigger = {
				any_artifact = {
					count < 15
					has_variable = ibeji
				}
				$LOCATION$ ?= { geographical_region = world_africa_west }
			}
			create_artifact_ibeji_effect = { OWNER = ROOT }
		}
		10 = { #Nagelring
			trigger = {
				any_artifact = {
					count < 1
					has_variable = nagelring
				}
				$LOCATION$ ?= { geographical_region = world_europe_west_germania }
			}
			create_artifact_nagelring_effect = { OWNER = ROOT }
		}
		10 = { #szczerbiec
			trigger = {
				current_date > 1080.1.1
				any_artifact = {
					count < 1
					has_variable = szczerbiec
				}
				$LOCATION$ ?= { geographical_region = world_europe_east }
			}
			create_artifact_szczerbiec_effect = { OWNER = ROOT }
		}
		10 = { #Kladenets
			trigger = {
				any_artifact = {
					count < 1
					has_variable = kladenets
				}
				$LOCATION$ ?= { geographical_region = world_europe_east }
			}
			create_artifact_kladenets_effect = { OWNER = ROOT }
		}
		10 = { #Legbiter
			trigger = {
				current_date > 1120.1.1
				any_artifact = {
					count < 1
					has_variable = legbiter
				}
				$LOCATION$ ?= { geographical_region = world_europe_north }
			}
			create_artifact_legbiter_effect = { OWNER = ROOT }
		}
		10 = { #Quern-Biter
			trigger = {
				current_date > 920.1.1
				any_artifact = {
					count < 1
					has_variable = quernbiter
				}
				$LOCATION$ ?= { geographical_region = world_europe_north }
			}
			create_artifact_quernbiter_effect = { OWNER = ROOT }
		}
		15 = { #Navaratna
			trigger = {
				$LOCATION$ ?= { geographical_region = world_india }
				any_artifact = {
					count < 3
					has_variable = navaratna
				}
			}
			create_artifact_navaratna_effect = { OWNER = ROOT }
		}
		10 = { #Dragvandil
			trigger = {
				current_date > 920.1.1
				any_artifact = {
					count < 1
					has_variable = dragvandil
				}
				$LOCATION$ ?= { geographical_region = world_europe_north }
			}
			create_artifact_dragvandil_effect = { OWNER = ROOT }
		}
		5 = { #Ruyi
			trigger = {
				any_artifact = {
					count < 15
					has_variable = ruyi
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_india
						geographical_region = world_burma
						geographical_region = world_tibet
					}
				}
			}
			create_artifact_ruyi_effect = { OWNER = ROOT }
		}
		5 = { #Turquoise Throne
			trigger = {
				any_artifact = {
					count < 1
					has_variable = turquoise_throne
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_india
						geographical_region = world_burma
						geographical_region = world_middle_east_persia
					}
				}
			}
			create_artifact_turquoise_throne_effect = { OWNER = ROOT }
		}
		5 = { #Peacock Throne
			trigger = {
				any_artifact = {
					count < 1
					has_variable = peacock_throne
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_india
						geographical_region = world_burma
						geographical_region = world_middle_east_persia
					}
				}
			}
			create_artifact_peacock_throne_effect = { OWNER = ROOT }
		}
		5 = { #Mantle of the Prophet
			trigger = {
				any_artifact = {
					count < 1
					has_variable = mantle_of_prophet
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east
						geographical_region = world_middle_east_persia
					}
				}
			}
			create_artifact_mantle_of_the_prophet_effect = { OWNER = ROOT }
		}
		5 = { #Spear of the Prophet
			trigger = {
				any_artifact = {
					count < 1
					has_variable = spear_of_the_prophet
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east
						geographical_region = world_middle_east_persia
					}
				}
			}
			create_artifact_spear_of_the_prophet_effect = { OWNER = ROOT }
		}
		10 = { #FP3 Sassanian Sword
			trigger = {
				any_artifact = {
					count < 15
					has_variable = sassanian_sword
				}
				$LOCATION$ ?= {
					OR = {
						geographical_region = world_middle_east
						geographical_region = world_middle_east_persia
					}
				}
			}
			create_artifact_illustrious_sassanian_sword_effect = { OWNER = ROOT }
		}
		2 = { #Narwhal Horn
			trigger = { 
				$LOCATION$ ?= { geographical_region = world_europe_north }
			}
			create_artifact_wall_narwhal_horn_effect = {
				OWNER = scope:owner
				HUNTER = scope:inspiration_owner
			}
		}
		1 = { #Fallback Relic
			create_artifact_pedestal_branch_relic_general_effect = {
				OWNER = root
				RELIGION = $LOCATION$.religion
			}
		}
	}
}

select_random_saint_effect = {
	save_scope_as = owner
	random_list = {
		1 = {
			trigger = {
				OR = {
					faith = faith:catholic
					faith = faith:orthodox
					faith = faith:nestorian
				}
			}
			set_variable = {
				name = saint
				value = flag:brigid
				days = 5
			} 
		}

		1 = {
			trigger = {
				OR = {
					faith = faith:catholic
					faith = faith:orthodox
					faith = faith:nestorian
				}
			}
			set_variable = {
				name = saint
				value = flag:matthew
				days = 5
			} 
		}

		1 = {
			trigger = {
				OR = {
					faith = faith:catholic
					faith = faith:orthodox
					faith = faith:nestorian
				}
			}
			set_variable = {
				name = saint
				value = flag:joseph
				days = 5
			} 
		}

		1 = {
			trigger = {
				OR = {
					faith = faith:catholic
					faith = faith:orthodox
					faith = faith:nestorian
				}
			}
			set_variable = {
				name = saint
				value = flag:catherine
				days = 5
			} 
		}

		1 = {
			trigger = {
				OR = {
					faith = faith:catholic
					faith = faith:orthodox
					faith = faith:nestorian
				}
			}
			set_variable = {
				name = saint
				value = flag:george
				days = 5
			} 
		}

		1 = {
			trigger = {
				OR = {
					faith = faith:catholic
					faith = faith:orthodox
					faith = faith:nestorian
				}
			}
			set_variable = {
				name = saint
				value = flag:nicholas
				days = 5
			} 
		}

		1 = {
			trigger = {
				OR = {
					faith = faith:coptic
					faith = faith:armenian_apostolic
				}
			}
			set_variable = {
				name = saint
				value = flag:marina
				days = 5
			} 
		}

		1 = {
			trigger = {
				OR = {
					faith = faith:coptic
					faith = faith:armenian_apostolic
				}
			}
			set_variable = {
				name = saint
				value = flag:matthew
				days = 5
			} 
		}

		1 = {
			trigger = {
				OR = {
					faith = faith:coptic
					faith = faith:armenian_apostolic
				}
			}
			set_variable = {
				name = saint
				value = flag:joseph
				days = 5
			} 
		}

		1 = {
			trigger = {
				OR = {
					faith = faith:coptic
					faith = faith:armenian_apostolic
				}
			}
			set_variable = {
				name = saint
				value = flag:mark
				days = 5
			} 
		}

		1 = {
			trigger = {
				OR = {
					faith = faith:coptic
					faith = faith:armenian_apostolic
				}
			}
			set_variable = {
				name = saint
				value = flag:maurice
				days = 5
			} 
		}
	}
	#fallback
	if = {
		limit = { NOT = { exists = var:saint } }
		set_variable = {
			name = saint
			value = flag:fallback
			days = 5
		}
	}
}

add_scaled_artifact_modifier_trait_track_hunter_xp_gain_mult_effect = {
	if = {
		limit = { rarity = common }
		random_list = {
			20 = { add_artifact_modifier = artifact_trait_track_hunter_xp_gain_mult_1_modifier }
			5 = { add_artifact_modifier = artifact_trait_track_hunter_xp_gain_mult_2_modifier }
		}
	}
	else_if = {
		limit = { rarity = masterwork }
		random_list = {
			20 = { add_artifact_modifier = artifact_trait_track_hunter_xp_gain_mult_2_modifier }
			5 = { add_artifact_modifier = artifact_trait_track_hunter_xp_gain_mult_3_modifier }
		}
	}
	else_if = {
		limit = { rarity = famed }
		random_list = {
			20 = { add_artifact_modifier = artifact_trait_track_hunter_xp_gain_mult_3_modifier }
			5 = { add_artifact_modifier = artifact_trait_track_hunter_xp_gain_mult_4_modifier }
		}
	}
	else_if = {
		limit = { rarity = illustrious }
		add_artifact_modifier = artifact_trait_track_hunter_xp_gain_mult_4_modifier
	}
}
